Every modern Linux distribution comes with a set of tools for installing and updating software. Such tools are called package managers.
Package managers help you find software, download it to your computer and install or upgrade it. When a certain software package can’t work without additional components, relevant software packages will be installed automatically.
In Red Hat family of operating systems the package manager is called yum. In recent years it’s been replaced with backward-compatible tool called dnf.
yum package manager
yum stands for Yet Another package Manager.
When running the yum command you should specify a sub command followed by optional package or file names.
IMPORTANT: Many functions of the package manager can be used by regular users, but installing and removing software requires root privilege.
List installed software packages
Here’s how you can list all the installed packages on your system (warning! it will be a long list)
yum lets you find new software, too. If you are a user of bash shell, you can easily find all the related autocompletion packages like this:
$ yum search bash
Last metadata expiration check: 0:06:11 ago on Mon 01 Mar 2021 10:50:35 GMT.
================================================================== Name Exactly Matched: bash ==================================================================
bash.x86_64 : The GNU Bourne Again shell
================================================================= Name & Summary Matched: bash =================================================================
argbash.noarch : Bash argument parsing code generator
bash-completion.noarch : Programmable completion for Bash
bash-doc.x86_64 : Documentation files for bash
bashmount.noarch : A menu-driven bash script for mounting removable media
coccinelle-bash-completion.noarch : Bash tab-completion for coccinelle
drbd-bash-completion.x86_64 : Programmable bash completion support for drbdadm
libguestfs-bash-completion.noarch : Bash tab-completion scripts for libguestfs tools
libvirt-bash-completion.x86_64 : Bash completion script
nbdkit-bash-completion.noarch : Bash tab-completion for nbdkit
pcp-pmda-bash.x86_64 : Performance Co-Pilot (PCP) metrics for the Bash shell
python-django-bash-completion.noarch : bash completion files for Django
python-django3-bash-completion.noarch : Bash completion files for Django
python3-colcon-bash.noarch : Extension for colcon to provide Bash scripts
votca-csg-bash.noarch : Bash completion for VOTCA CSG
yum search output shows you exact matches first - packages that fully match your search pattern. Later in the output you can see all the packages that have your pattern in the package name: bash-completion, bash-doc etc.
Install software with yum
Once you know a package name, just use the yum install command to have it downloaded and installed.
Software installation is a global change in your operating system, this means you will have to use sudo command when running yum install.
If you try running yum install as regular user, you’ll see an error:
$ yum install bash-doc
Error: This command has to be run with superuser privileges (under the root user on most systems).
Let’s use sudo and yum to install the bash-doc package:
$ sudo yum install bash-doc
Last metadata expiration check: 1:20:45 ago on Mon 01 Mar 2021 09:44:35 GMT.
Dependencies resolved.
================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================
Installing:
bash-doc x86_64 4.4.19-12.el8 baseos 1.2 M
Transaction Summary
================================================================================================================================================================
Install 1 Package
Total download size: 1.2 M
Installed size: 4.6 M
Is this ok [y/N]: y
Downloading Packages:
bash-doc-4.4.19-12.el8.x86_64.rpm 27 MB/s | 1.2 MB 00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 5.2 MB/s | 1.2 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : bash-doc-4.4.19-12.el8.x86_64 1/1
Verifying : bash-doc-4.4.19-12.el8.x86_64 1/1
Installed:
bash-doc-4.4.19-12.el8.x86_64
Complete!
Congratulations! You now know how to install software with yum.
Uninstall Software with yum
Let’s learn the last basic function of using package manager in Red Hat: uninstalling software packages.
You’ll need sudo privilege and specify exact package name in order to uninstall it:
$ yum remove bash-doc
Error: This command has to be run with superuser privileges (under the root user on most systems).
[[email protected] ~]$ sudo yum remove bash-doc
Dependencies resolved.
================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================
Removing:
bash-doc x86_64 4.4.19-12.el8 @baseos 4.6 M
Transaction Summary
================================================================================================================================================================
Remove 1 Package
Freed space: 4.6 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Erasing : bash-doc-4.4.19-12.el8.x86_64 1/1
Verifying : bash-doc-4.4.19-12.el8.x86_64 1/1
Removed:
bash-doc-4.4.19-12.el8.x86_64
Complete!
Well done! Basic knowledge of yum/dnf usage will let you quickly check, install or remove software as necessary.
I learn with Educative:
I'm also a fan of SetApp for macOS:
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!