Skip to main content

How to install software packages on Red Hat Enterprise Linux (RHEL)

Learn how to install software with RHEL's package manager using the dnf command or the GNOME Software app.
Image
How to capture terminal sessions using the script commandPhoto by Sora Shimazaki from Pexels

Photo by Sora Shimazaki from Pexels

There's a lot of flexibility in how you install an application on Linux. It's partly up to the software's developer to decide how to deliver it to you. In many cases, there's more than one "right" way to install something.

However, when an application is mission-critical, it's important that you get timely and reliable updates. The best way for that to happen is to install software from a central hub. On Red Hat Enterprise Linux (RHEL), that central hub for application installation and maintenance is the dnf (formerly known as yum) package manager.

Using a package manager ensures that every file installed on your system is dutifully recorded in a database, and each package can be updated when a new release is available. RHEL provides two ways to interact with its package manager: the dnf command and the GNOME Software app.

Search software repositories

Applications available on Red Hat's servers are divided into several software repositories. These include the BaseOS, AppStream, Red Hat Linux Builder (previously called CodeReady Linux Builder), and Supplementary repositories.

To see the repositories enabled on your system, use the dnf repolist command along with the --all option. It's a long list, so pipe it through the more pager to scroll through it:

$ sudo dnf repolist --all | more
amq-interconnect-textonly-1-for-middleware-rpms    Red Hat A disabled
amq-textonly-1-for-middleware-rpms                 Red Hat J disabled
ansible-automation-platform-2.2-for-rhel-9-...     Red Hat A disabled
ansible-automation-platform-2.2-for-rhel-9-...     Red Hat A disabled
ansible-automation-platform-2.2-for-rhel-9-...     Red Hat A disabled
codeready-builder-for-rhel-9-x86_64-debug-rpms     Red Hat C disabled
codeready-builder-for-rhel-9-x86_64-eus-debug-rpms Red Hat C disabled
codeready-builder-for-rhel-9-x86_64-eus-rpms       Red Hat C disabled
codeready-builder-for-rhel-9-x86_64-eus-source...  Red Hat C disabled
codeready-builder-for-rhel-9-x86_64-rpms           Red Hat C enabled
codeready-builder-for-rhel-9-x86_64-source-rpms    Red Hat C disabled
[...]

To enable a repository, use the dnf config-manager subcommand with the --enable option and the name of the repository as listed. For instance, to enable the rhel-9-for-x86_64-supplementary-rpms repository:

$ sudo dnf config-manager --enable rhel-9-for-x86_64-supplementary-rpms
Updating Subscription Management repositories.

[ Download a free Bash shell scripting cheat sheet. ]

Find software to install

If you know what application you want to install, you can verify that it's in the repository by searching for its name or even just part of its name:

$ sudo dnf search toolbox
Updating Subscription Management repositories.
==== Name Exactly Matched: toolbox ===========
toolbox.x86_64 : Tool for containerized command line environments on Linux

Install software from a remote repository

To install an application, use the install subcommand:

$ sudo dnf install toolbox

Install from a local filesystem

Sometimes you might need to install software that's been developed in-house or that's sent to you from a vendor or trusted developer. As long as an application is packaged in the RPM format, you can install it using dnf. As with software installed from a remote repository, using dnf records every file installed along with a package, so it can accurately update or remove those files later.

There's no special command to install a local RPM file. It's essentially the same as installing from a repository, except that you must provide the path to the RPM file:

$ sudo dnf install ~/Downloads/example-1.0.0_1.rpm

If there are any requirements for this RPM available from a remote repository, dnf installs them before installing the package.

Browse GNOME Software

Instead of installing everything in a terminal, you can browse for desktop and graphical applications with the GNOME Software application. By default, GNOME Software displays only applications available from the BaseOS and AppStream repositories. You can view all available repositories with the Software repositories menu selection in the top-right corner of the browser.

Image
Software repositories menu
(Seth Kenlon, CC BY-SA 4.0)

Software is sparsely populated at first, even with several additional RPM repositories enabled. But you can add desktop-focused repositories (using a package format called Flatpak) to provide your workstation users a wealth of GUI application choices. First, open a browser and navigate to Flatpak.org and follow steps 2 and 3: Install the Flathub repository file and Restart.

After adding the Flathub repository, your application selection options go from a few dozen to hundreds.

Image
GNOME Software menu
(Seth Kenlon, CC BY-SA 4.0)

Updating software

One advantage of managing software with a set of central tools like dnf and GNOME Software is that updates are also centralized. You can update all installed applications:

$ sudo dnf update

Alternatively, you can update just one application:

$ sudo dnf update nginx

Similarly, GNOME Software alerts you to available updates, so you can update all applications or a subset of them with just a few clicks.

Applications on Linux

Application management is arguably one of the most innovative features of Linux. Modern "app stores" wouldn't exist without the example of package manager commands like dnf (and yum and rpm before it.)

Put micromanaging applications behind you, and embrace a smart system design that empowers you to keep your computers updated, healthy, and fully prepared for any productivity challenge.

Author’s photo

Seth Kenlon

Seth Kenlon is a UNIX geek and free software enthusiast. More about me

Try Red Hat Enterprise Linux

Download it at no charge from the Red Hat Developer program.