Merge pull request #10087 from geekpi/new

translated
This commit is contained in:
Xingyu.Wang 2018-09-06 10:14:32 +08:00 committed by GitHub
commit e611edf584
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 106 additions and 108 deletions

View File

@ -1,108 +0,0 @@
translating----geekpi
How to install software from the Linux command line
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/suitcase_container_bag.png?itok=q40lKCBY)
If you use Linux for any amount of time, you'll soon learn there are many different ways to do the same thing. This includes installing applications on a Linux machine via the command line. I have been a Linux user for roughly 25 years, and time and time again I find myself going back to the command line to install my apps.
The most common method of installing apps from the command line is through software repositories (a place where software is stored) using what's called a package manager. All Linux apps are distributed as packages, which are nothing more than files associated with a package management system. Every Linux distribution comes with a package management system, but they are not all the same.
### What is a package management system?
A package management system is comprised of sets of tools and file formats that are used together to install, update, and uninstall Linux apps. The two most common package management systems are from Red Hat and Debian. Red Hat, CentOS, and Fedora all use the `rpm` system (.rpm files), while Debian, Ubuntu, Mint, and Ubuntu use `dpkg` (.deb files). Gentoo Linux uses a system called Portage, and Arch Linux uses nothing but tarballs (.tar files). The primary difference between these systems is how they install and maintain apps.
You might be wondering what's inside an `.rpm`, `.deb`, or `.tar` file. You might be surprised to learn that all are nothing more than plain old archive files (like `.zip`) that contain an application's code, instructions on how to install it, dependencies (what other apps it may depend on), and where its configuration files should be placed. The software that reads and executes all of those instructions is called a package manager.
### Debian, Ubuntu, Mint, and others
Debian, Ubuntu, Mint, and other Debian-based distributions all use `.deb` files and the `dpkg` package management system. There are two ways to install apps via this system. You can use the `apt` application to install from a repository, or you can use the `dpkg` app to install apps from `.deb` files. Let's take a look at how to do both.
Installing apps using `apt` is as easy as:
```
$ sudo apt install app_name
```
Uninstalling an app via `apt` is also super easy:
```
$ sudo apt remove app_name
```
To upgrade your installed apps, you'll first need to update the app repository:
```
$ sudo apt update
```
Once finished, you can update any apps that need updating with the following:
```
$ sudo apt upgrade
```
What if you want to update only a single app? No problem.
```
$ sudo apt update app_name
```
Finally, let's say the app you want to install is not available in the Debian repository, but it is available as a `.deb` download.
```
$ sudo dpkg -i app_name.deb
```
### Red Hat, CentOS, and Fedora
Red Hat, by default, uses several package management systems. These systems, while using their own terminology, are still very similar to each other and to the one used in Debian. For example, we can use either the `yum` or `dnf` manager to install apps.
```
$ sudo yum install app_name
$ sudo dnf install app_name
```
Apps in the `.rpm` format can also be installed with the `rpm` command.
```
$ sudo rpm -i app_name.rpm
```
Removing unwanted applications is just as easy.
```
$ sudo yum remove app_name
$ sudo dnf remove app_name
```
Updating apps is similarly easy.
```
$ yum update
$ sudo dnf upgrade --refresh
```
As you can see, installing, uninstalling, and updating Linux apps from the command line isn't hard at all. In fact, once you get used to it, you'll find it's faster than using desktop GUI-based management tools!
For more information on installing apps from the command line, please visit the Debian [Apt wiki][1], the [Yum cheat sheet][2], and the [DNF wiki][3].
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/8/how-install-software-linux-command-line
作者:[Patrick H.Mullins][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/pmullins
[1]:https://wiki.debian.org/Apt
[2]:https://access.redhat.com/articles/yum-cheat-sheet
[3]:https://fedoraproject.org/wiki/DNF?rd=Dnf

View File

@ -0,0 +1,106 @@
如何从 Linux 命令行安装软件
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/suitcase_container_bag.png?itok=q40lKCBY)
如果你在任何时间都使用 Linux你很快就会发现有很多不同的方法可以做同样的事情。这包括通过命令行在 Linux 上安装应用。我已经是大约 25 年的 Linux 用户,我一次又一次地回到命令行来安装我的应用。
从命令行安装应用程序最常用的方法是使用称为包管理器的软件库(存储软件的地方)。所有 Linux 应用都作为软件包分发,这些软件包只不过是与软件包管理系统相关的文件。每个 Linux 发行版都附带一个包管理系统,但它们并不完全相同。
### 什么是包管理系统?
包管理系统由多组工具和文件格式组成,它们一起用于安装、更新和卸载 Linux 应用。两种最常见的包管理系统来自 Red Hat 和 Debian。 Red Hat、CentOS 和 Fedora 都使用 `rpm` 系统(.rpm 文件而Debian、Ubuntu、Mint 和 Ubuntu 都使用 `dpkg`.deb 文件。Gentoo Linux 使用名为 Portage 的系统Arch Linux 只使用 tarball.tar 文件)。这些系统之间的主要区别在于它们如何安装和维护应用。
你可能想知道 `.rpm`、`.deb` 或 `.tar` 文件中的内容。你可能会惊讶地发现,所有这些都只是普通的老式归档文件(如 `.zip`),其中包含应用的代码,如何安装它的说明,依赖项(它可能依赖的其他应用),以及配置文件的位置。读取和执行所有这些指令的软件称为包管理器。
### Debian、Ubuntu、Mint 等
Debian、Ubuntu、Mint 和其他基于 Debian 的发行版都使用 `.deb` 文件和 `dpkg` 包管理系统。有两种方法可以通过此系统安装应用。你可以使用 `apt` 程序从仓库进行安装,也可以使用 `dpkg` 程序从 `.deb` 文件安装应用。我们来看看如何做到这两点。
使用 `apt` 安装应用非常简单:
```
$ sudo apt install app_name
```
通过 `apt` 卸载应用也非常简单:
```
$ sudo apt remove app_name
```
要升级已安装的应用,首先需要更新应用仓库:
```
$ sudo apt update
```
完成后,你可以使用以下命令更新任何程序:
```
$ sudo apt upgrade
```
如果你只想更新一个应用,该怎么办?没问题。
```
$ sudo apt update app_name
```
最后,假设你要安装的应用不存在于 Debian 仓库中,但有 `.deb` 下载。
```
$ sudo dpkg -i app_name.deb
```
### Red Hat、CentOS 和 Fedora
默认情况下Red Hat 使用多个包管理系统。这些系统在使用自己的命令时,互相仍然非常相似,而且与 Debian 中使用的也相似。例如,我们可以使用 `yum``dnf` 管理器来安装应用。
```
$ sudo yum install app_name
$ sudo dnf install app_name
```
`.rpm` 格式的应用也可以使用 `rpm` 命令安装。
```
$ sudo rpm -i app_name.rpm
```
删除不需要的应用同样容易。
```
$ sudo yum remove app_name
$ sudo dnf remove app_name
```
更新应用同样容易。
```
$ yum update
$ sudo dnf upgrade --refresh
```
如你所见,从命令行安装、卸载和更新 Linux 应用并不难。事实上,一旦你习惯它,你会发现它比使用基于桌面 GUI 的管理工具更快!
有关从命令行安装应用程序的更多信息,请访问 Debian [Apt wiki][1]、[Yum 速查表][2] 和 [DNF wiki][3]。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/8/how-install-software-linux-command-line
作者:[Patrick H.Mullins][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/pmullins
[1]:https://wiki.debian.org/Apt
[2]:https://access.redhat.com/articles/yum-cheat-sheet
[3]:https://fedoraproject.org/wiki/DNF?rd=Dnf