How to install applications from the command line in CentOS 8

CentOS 8 has been released and it comes with a number of important changes, changes that will directly affect how you manage those Linux servers in your data center. One of the more immediate changes is how you install applications from the command line.

Prior to the eighth iteration, CentOS used the yum package manager. As of CentOS 8, package management has migrated from yum to Dandified Yum (DNF). How that works, I cannot figure out--maybe they should have named it DNY or DFY. DNF was introduced way back in Fedora 18 and became the default package manager in Fedora 22, so it's taken a while to make its way to the server OS.

But here it is, and you'll need to know how to use it. Fortunately, it's very similar to yum. Let's find out how similar.

SEE: Hiring kit: Database administrator (TechRepublic Premium)

Basic use of DNF

In its simplest form, installing a package with DNF looks like this:

Where PACKAGE is the name of the package to be installed.

To remove a package, the command is:

Where PACKAGE is the name of the package to be removed.

To update software on your system, issue the command:

This will run all available updates on your system. To upgrade a specific package, you can issue the command:

Where PACKAGE is the name of the package to be updated.

How to use group install with DNF

DNF has a pretty cool trick up its sleeve, called group install. With group install, you can use a single command to install all packages related to a group. To see a list of all available groups, issue the command:

For instance, if you want to install the Network Servers package (which includes the likes of dhcp-server, dnsmasq, krb5-server, libreswan, radvd, rsyslog-gnutls, syslinux, tftp-server), issue the command:

Note that the group list command doesn't show a number of hidden groups. To view the installable hidden groups, issue the command:

From that list, you can then install one of the hidden groups in the same manner you installed the visible groups.

And that's the gist of using the DNF package manager found in CentOS 8. You shouldn't have any problems migrating from yum, as they are quite similar. Fortunately, for those that have trouble with change, the yum package manager remains intact, for now. However, I do suggest that you migrate to DNF, as yum probably won't remain for long (as it has been deprecated).

Also see