<h1>Install packages on RHEL</h1>

<p>
There's a lot of flexibility in how you install an application on Linux.
It's partly up to the developer of the software 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 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 to 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 itself and the GNOME Software app.
</p>

<h2>Software repositories</h2>
<p>
Applications available on Red Hat's servers are divided into several software repositories.
These include the BaseOS, AppStream, CodeReady Linux Builder, and Supplementary repositories.
</p><p>
To see the repositories enabled on your system, use the <code>dnf repolist</code> command along with the <code>--all</code> option.
It's a long list, so pipe it through the <code>more</code> pager to scroll through it.
</p>
<pre><code>
$ 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
[...]
</code></pre>
<p>To enable a repository, use the <code>dnf config-manager</code> subcommand with the  `--enable` option and the name of the repository as listed.
For instance, to enable the <code>rhel-9-for-x86_64-supplementary-rpms</code> repository:
</p>
<pre><code>$ sudo dnf config-manager --enable rhel-9-for-x86_64-supplementary-rpms
Updating Subscription Management repositories.
</code></pre>
<h2>Finding software</h2>
<p>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.</p>
<pre><code>$ sudo dnf search toolbox
Updating Subscription Management repositories.
==== Name Exactly Matched: toolbox ===========
toolbox.x86_64 : Tool for containerized command line environments on Linux
</code></pre>
<h2>Install software from a remote repository</h2>
<p>To install an application, use the <code>install</code> subcommand:</p>
<pre><code>$ sudo dnf install toolbox</code></pre>

<h2>Install from a local file system</h2>
<p>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 <code>dnf</code>.
As with software installed from a remote repository, using <code>dnf</code> records every file installed along with a package, so it can accuartely update or remove those files later.
</p>
<p>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 itself.
</p>
<pre><code>$ sudo dnf install ~/Downloads/example-1.0.0_1.rpm</code></pre>
<p>If there are any requirements for this RPM available from a remote repository, <code>dnf</code> installs them before installing the package.</p>
<h2>GNOME Software</h2>
<p>
Instead of installing everything in a terminal, you can browse for desktop and graphical applications with GNOME Software application.
By default, GNOME Software only displays applications available from the BaseOS and AppStream repositories.
You can view all available repositories with the <strong>Software repositories</strong> menu selection in the top right corner of the browser.
</p>

<p>ADD IMAGE software-menu-repositories.jpg</p>

<p>
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 it to provide your workstation users a wealth of GUI application choices.
First, open a browser and navigate to <a href="https://flatpak.org/setup/Red%20Hat%20Enterprise%20Linux</a>Flatpak.org</a> and follow steps 2 and 3: Install the Flathub repository file, and then restart.
</p>

<p>After adding the Flathub repository, application selection goes from a few dozen to hundreds.
</p>

<p>ADD IMAGE software-menu-apps.jpg</p>

<h2>Updating software</h2>

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

<pre><code>
$ sudo dnf update
</code></pre>

<p>
Alternatively, you can update just one application:
</p>

<pre><code>
$ sudo dnf update nginx
</code></pre>

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

<h2>Applications on Linux</h2>

<p>
Application management is arguably one of the most innovative features of Linux.
Modern "app stores" wouldn't exist hadn't it been for the example of package manager commands like <code>dnf</code> (and <code>yum</code> and <code>rpm</code> before it.)
Put micro-managing 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.
</p>