Skip to main content

RHCSA Certification Course

Chapter #11: Linux Package Management and System Logs

Learn how to install, update, and remove packages using DNF and RPM, automate tasks with cron, and monitor Linux logs in this Red Hat beginner guide.

In this chapter, we will review how to install, update, and remove packages in Red Hat Enterprise Linux. We will also cover how to automate tasks using cron, and will finish this guide explaining how to locate and interpret system log files with the focus of teaching you why all of these are essential skills for every system administrator.

Managing Packages Using DNF

To install a package along with all its dependencies that are not already installed, you will use:

dnf -y install package_name(s)

Where package_name(s) represent at least one real package name. For example, to install httpd and mlocate (in that order), type:

dnf -y install httpd mlocate

Note that the letter y in the example above bypasses the confirmation prompts that dnf presents before performing the actual download and installation of the requested programs. You can leave it out if you want.

By default, dnf will install the package with the architecture that matches the OS architecture, unless overridden by appending the package architecture to its name.

For example, on a 64-bit system, dnf install package will install the x86_64 version of the package, whereas yum install package.i686 (if available) will install the 32-bit one.

There will be times when you want to install a package but don’t know its exact name. The search or search all options can search the currently enabled repositories for a certain keyword in the package name and/or in its description, respectively.

For example:

dnf search log

Will search the installed repositories for packages with the word log in their names and summaries, whereas:

dnf search all log

Will look for the same keyword in the package description and URL fields as well.

Once the search returns a package listing, you may want to display further information about some of them before installing. That is when the info option will come in handy (see Fig. 1):

yum info logwatch
Figure 1: Viewing package information using dnf

You can regularly check for updates with the following command:

dnf check-update

If there are several packages that can be updated, dnf update will update all of them at once:

dnf update

Now, what happens when you know the name of an executable, such as ps2pdf, but don’t know which package provides it? You can find out with:

dnf whatprovides "*/ps2pdf"
Figure2: Finding out which package provides a specific utility

Now, when it comes to removing a package, you can do so with:

dnf remove package

Easy, huh? This goes to show that dnf is a complete and powerful package manager.