How to install applications from the command line using apt, dnf, and zypper

So you’re new to Linux. You know how to install applications from your distribution’s software center, but now it’s time to up your game and start installing from the command line. Although you can install from source, it’s always best to first install using the distribution’s package manager. By using this tool, you know the newly-installed app will be recognized by the system and can be easily updated But how do you do this? I am going to show you.

Installing applications with your distribution’s package manager is really easy. Even if you’re intimidated by the command line, this process should not, in any way, scare you away. I’m going to walk you through the process of installing and upgrading applications using apt, dnf, and zypper. I’ll demonstrate installing the same software (the Thunderbird email client) across all three tools.

Let’s get started.

apt

The Advanced Package Toolkit (apt) is a set of tools used for managing Debian packages (.deb files). Apt includes one of the most widely used command line tools for installing packages, apt-get. Since Thunderbird is found in the standard repositories, the installation is quite simple. We’ll be using apt-get to install the package. The structure of the command is:

apt-get OPTION COMMAND PACKAGE

Most often you will run the apt-get command without options. You won’t, however, find yourself running apt-get without commands. There are a number of commands available, but the most common are:

  • update – This resynchronizes the package index files from their sources
  • upgrade – This upgrades all packages installed on the system that can be found in /etc/apt/sources.list or have .list files in /etc/apt/sources.list.d
  • install – This will install the desired package
  • remove – This will remove the desired package

So, to install Thunderbird, our command would be:

apt-get install thunderbird

Chances are, you’ll be issuing this command on a system that requires sudo privileges, so in order to successfully run the command, you would have to add sudo like so:

sudo apt-get install thunderbird

Thunderbird would install and you’re ready to go. Once installed, if you want to update it, simply issue the install command again. To remove Thunderbird, issue the command:

sudo apt-get remove thunderbird

dnf

The dnf system is the Fedora replacement for yum. Believe it or not, dnf is used in similar fashion to that of apt. The structure of the command is even the same:

dnf OPTION COMMAND PACKAGE

Like apt, there are a number of available options and commands. You will, as a beginner, most often use the dnf tool without options. The three commands you’ll want to know as you begin using dnf are:

  • install – This installs a package
  • upgrade – This will update each package to the latest version (that is both available and resolvable)
  • remove – This will remove a package

So to install Thunderbird on a Fedora system, the command would be:

sudo dnf install thunderbird

To upgrade Thunderbird, the command would be:

sudo dnf upgrade thunderbird

To remove Thunderbird, the command would be:

sudo dnf remove thunderbird

Simple.

zypper

The zypper system is found on both SUSE and openSUSE. Zypper usage is very similar to that of apt-get and dnf. The command structure is:

zypper COMMAND OPTION PACKAGE

Notice the COMMAND and OPTION are reversed here. Since we’re covering only the basics, this will not come into play. The three commands you will want to know first are:

  • install – Install a package
  • remove – Remove a package
  • upgrade – Upgrade a package

To install Thunderbird with zypper, the command would be:

sudo zypper install thunderbird

To upgrade Thunderbird with zypper, the command would be:

sudo zypper upgrade thunderbird

To remove Thunderbird with zypper, the command would be:

sudo zypper remove thunderbird

Zypper also has a bit of shorthand you can use for the above:

sudo zypper in thunderbird
​sudo zypper up thunderbird
​sudo zypper rm thunderbird

By | May 17, 2017, 8:25 AM PST

Full article:

Source: How to install applications from the command line using apt, dnf, and zypper – TechRepublic

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.