Introduction
In this lab, you will learn the essential skills for managing software packages on RHEL-based Linux systems using the YUM package manager. You will begin by inspecting the details and dependencies of currently installed packages using the yum list and yum deplist commands. You will also explore your system's configured software repositories with yum repolist to understand where your software comes from and what is available.
Building on these foundational skills, you will shift your focus to system maintenance and updates. You will learn how to use yum check-update to identify packages that have newer versions available. Finally, you will practice applying these updates, learning the distinction between updating a single, specific package and performing a comprehensive full system update to keep your environment secure and current.
Inspect an Installed Package with 'yum list' and 'yum deplist'
In this step, you will learn how to inspect installed packages using yum, the default package manager for CentOS and other RHEL-based Linux distributions. We will start by examining the bash package, which provides the shell environment you are likely using. These commands help you understand what is installed on your system and what other components a package relies on to function.
First, let's use the yum list command to check the status of a specific package. This command can tell you if a package is installed and which version is on your system.
To check the details of the bash package, execute the following command in your terminal:
sudo yum list bash
You will see output similar to this, confirming that bash is installed. The @ symbol in the repository column (e.g., @anaconda or @System) indicates an installed package.
Installed Packages
bash.x86_64 <version> @anaconda
Next, let's explore the concept of dependencies. Most software packages are not self-contained; they rely on other packages, such as libraries or tools, to work correctly. These required packages are called dependencies. The yum deplist command allows you to see a full list of dependencies for a given package.
To see all the packages that the bash package depends on, run this command:
sudo yum deplist bash
The output will list each dependency and the package that provides it. This is crucial for understanding how yum resolves and manages software installations.
package: bash.x86_64 <version>
dependency: /bin/sh
provider: bash.x86_64 <version>
dependency: chkconfig
provider: chkconfig.x86_64 <version>
dependency: coreutils
provider: coreutils.x86_64 <version>
dependency: libc.so.6(GLIBC_2.15)(64bit)
provider: glibc.x86_64 <version>
... (output truncated) ...
By using yum list and yum deplist, you can gain a clear understanding of the packages installed on your system and their relationships with each other.
Explore Repositories and Available Packages with 'yum repolist'
In this step, you'll learn how to explore the software sources, known as repositories, that yum uses to find and install packages. You will also learn how to search for new packages that are available to be installed on your system.
A package repository is a centralized storage location where software packages are kept. When you ask yum to install a package, it contacts the configured repositories, downloads the necessary files, and installs them on your system.
To see a list of the repositories that are currently enabled on your system, you can use the yum repolist command. This is useful for verifying which software sources are active.
Execute the following command in your terminal:
sudo yum repolist
The output will display a list of repository IDs, their names, and the number of packages they contain. It will look something like this:
repo id repo name
rhui-rhel-9-for-x86_64-appstream-rhui-rpms Red Hat Enterprise Linux 9 for x86_64 - AppStream from RHUI (RPMs)
rhui-rhel-9-for-x86_64-baseos-rhui-rpms Red Hat Enterprise Linux 9 for x86_64 - BaseOS from RHUI (RPMs)
Now that you know where yum looks for packages, let's find out what packages are available for installation. The yum list available command shows all packages from your enabled repositories that are not yet installed on your system.
Running yum list available by itself would produce a very long list. It's more practical to search for something specific. Let's search for available packages related to the Linux kernel. You can use a wildcard (*) to match multiple package names.
Execute this command to list all available packages that start with kernel:
sudo yum list available 'kernel*'
The single quotes around kernel* are important to prevent the shell from trying to expand the wildcard itself. The output will show a list of available kernel-related packages, their versions, and the repository they come from.
Available Packages
kernel-devel.x86_64 <version> updates
kernel-doc.noarch <version> updates
kernel-headers.x86_64 <version> updates
... (output truncated) ...
These commands are essential for managing your system's software, allowing you to see your software sources and discover new tools to install.
Check for Available Updates with 'yum check-update'
In this step, you will learn how to check for available software updates for the packages installed on your system. Keeping your system updated is a critical task for security and stability, as updates often contain patches for vulnerabilities, bug fixes, and new features.
The yum check-update command provides a safe way to see which of your installed packages have newer versions available in the repositories. It's important to note that this command only lists the available updates; it does not download or install them. This allows you to review potential changes before applying them.
To check for all available updates on your system, execute the following command in your terminal:
sudo yum check-update
yum will now connect to all your enabled repositories, refresh its local cache of package information, and compare the versions of your installed packages with the latest versions available.
If there are updates available, you will see a list of them, similar to the following example. Each line shows the package name, the new version, and the repository it will be updated from.
bind-libs.x86_64 <version> updates
bind-license.noarch <version> updates
curl.x86_64 <version> updates
glibc.x86_64 <version> updates
glibc-common.x86_64 <version> updates
... (output truncated) ...
If your system is already fully up-to-date, the command will complete without listing any packages. This command is an essential part of routine system maintenance, giving you a clear picture of your system's status before you proceed with the actual update process in the next steps.
Apply a Single Package Update with 'yum update '
In this step, you will apply a specific package update. In the previous step, you used yum check-update to see a list of all packages with available updates. While it's common to update the entire system at once, there are situations where you might want to update only a single package. This gives you more control over system changes.
Let's choose a package from the list you saw earlier to update. We will use curl as an example, which is a common tool for transferring data. If curl was not on your list of available updates, you can choose another package from that list.
Before updating the package, we need to downgrade the curl package to a version that has an update available.
sudo yum downgrade -y curl
To update only the curl package, run the following command:
sudo yum update curl
yum will now resolve dependencies for curl, determine what needs to be updated, and present you with a transaction summary. This summary shows which packages will be updated and the total download size.
Resolving Dependencies
--> Running transaction check
---> Package curl.x86_64 0:<old_version> will be updated
---> Package curl.x86_64 0:<new_version> will be an update
--> Processing Dependency: libcurl = <new_version> for package: curl-<new_version>.x86_64
--> Running transaction check
---> Package libcurl.x86_64 0:<old_version> will be updated
---> Package libcurl.x86_64 0:<new_version> will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
curl x86_64 <new_version> updates <size>
Updating for dependencies:
libcurl x86_64 <new_version> updates <size>
Transaction Summary
================================================================================
Upgrade 1 Package (+1 Dependent package)
Total download size: <total_size>
Is this ok [y/d/N]:
Review the changes. If you are ready to proceed, type y and press Enter. yum will then download and install the updates.
After the process is finished, you will see a "Complete!" message, confirming the update was successful.
...
Running transaction
Updating : libcurl-<new_version>.x86_64 1/4
Updating : curl-<new_version>.x86_64 2/4
Cleanup : curl-<old_version>.x86_64 3/4
Cleanup : libcurl-<old_version>.x86_64 4/4
Verifying : curl-<new_version>.x86_64 1/4
...
Updated:
curl.x86_64 <new_version>
Dependency Updated:
libcurl.x86_64 <new_version>
Complete!
You have now successfully updated a single package and its dependencies. This targeted approach is useful for applying specific security patches or feature updates without performing a full system upgrade.
Perform a Full System Update with 'yum update'
In this step, you will perform the most common and important package management task: a full system update. While updating single packages is useful, regularly updating all software on your system is crucial for maintaining security, stability, and receiving the latest features and bug fixes.
The yum update command, when run without specifying a package name, will check all installed packages against the versions available in your enabled repositories and update every package for which a newer version is found.
Warning: This process may download a large amount of data and can take a significant amount of time to complete, depending on how many updates are available and your network connection speed.
To begin the full system update, execute the following command in your terminal:
sudo yum update
Similar to updating a single package, yum will first resolve all dependencies and then present you with a transaction summary. This list will likely be much longer than before, as it includes every package that needs to be updated.
Resolving Dependencies
--> Running transaction check
... (many packages listed) ...
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
bind-libs x86_64 <version> updates <size>
bind-license noarch <version> updates <size>
glibc x86_64 <version> updates <size>
glibc-common x86_64 <version> updates <size>
... (many more packages) ...
Transaction Summary
================================================================================
Upgrade <X> Packages
Total download size: <total_size>
Is this ok [y/d/N]:
Carefully review the list of packages to be updated. When you are ready to proceed, type n to skip the update, because it will take too long to update all the packages.
Congratulations! You have successfully updated your entire system. This is a fundamental skill for managing any Linux server or workstation, ensuring it remains secure and reliable.
Summary
In this lab, you learned the fundamentals of managing software packages on a RHEL-based Linux system using the YUM package manager. You began by inspecting an installed package with yum list to check its status and version, and then used yum deplist to examine its dependencies. You also explored the configured software sources by listing all active repositories with the yum repolist command.
The lab then guided you through the package update process. You learned how to check for available updates across the entire system without installing them using yum check-update. You practiced applying a specific update to a single package with yum update <package>, and concluded by performing a full system update with the yum update command to apply all available patches and software upgrades, ensuring the system remains current and secure.



