RHCSA Software Management & System Updates

Expertise in Cloud, Networking & DevOps
Photo by Gabriel Heinzer / Unsplash

πŸ“Œ Introduction

Managing software packages efficiently is a crucial skill for any Linux system administrator and is a key component of the RHCSA exam. This guide covers essential package management tasks in RHEL using YUM (Yellowdog Updater, Modified) / DNF (Dandified YUM), configuring repositories, and handling system updates.


πŸ“– What You’ll Learn in This Guide

πŸ”Ή Using YUM & DNF for package installation, updates, and removal

πŸ”Ή Managing and configuring software repositories

πŸ”Ή Understanding package groups and dependencies

πŸ”Ή Handling system updates and security patches

πŸ”Ή Troubleshooting package-related issues


πŸ›  Using YUM/DNF for Package Management

1️⃣ Checking Available Repositories

To list all enabled repositories:

dnf repolist  # Displays enabled repositories
yum repolist  # Works similarly in older RHEL versions

To list all repositories, including disabled ones:

dnf repolist all  # Shows both enabled and disabled repositories

πŸ” Best Practice: Always ensure repositories are correctly configured before installing software.


2️⃣ Installing Software Packages

To install a package, use the following command:

dnf install package-name -y  # -y auto-confirms installation
yum install package-name -y  # Equivalent for older versions

For example, to install the vim text editor:

dnf install vim -y

To install multiple packages at once:

dnf install vim wget curl -y

πŸ’‘ Tip: Use dnf info package-name to view details about a package before installation.


3️⃣ Removing Software Packages

To uninstall a package:

dnf remove package-name -y
yum remove package-name -y  # Equivalent in older RHEL

For example, to remove vim:

dnf remove vim -y

πŸ” Best Practice: Use dnf list installed | grep package-name to confirm whether a package is installed before removing it.


4️⃣ Updating and Upgrading Software

To update a single package:

dnf update package-name -y
yum update package-name -y

To update all installed packages:

dnf update -y  # Updates all packages
yum update -y  # Equivalent in older versions

To upgrade the entire system (including dependencies):

dnf upgrade -y
yum upgrade -y

πŸ” Best Practice: Always test updates in a non-production environment before applying them to critical systems.


βš™οΈ Configuring Software Repositories

1️⃣ Adding a New Repository

To add a custom repository, create a new .repo file under /etc/yum.repos.d/.

Example of adding a custom repository:

sudo tee /etc/yum.repos.d/custom.repo <<EOF
[custom]
name=Custom Repository
baseurl=http://mirror.example.com/customrepo/
enabled=1
gpgcheck=1
gpgkey=http://mirror.example.com/RPM-GPG-KEY-custom
EOF

To verify the repository:

dnf repolist

πŸ’‘ Tip: Use enabled=0 to disable a repository without deleting it.


2️⃣ Enabling & Disabling Repositories

To enable a specific repository:

dnf config-manager --set-enabled repo-name

To disable a repository:

dnf config-manager --set-disabled repo-name

To temporarily enable a disabled repository for a single command:

dnf install package-name --enablerepo=repo-name

πŸ” Searching & Listing Packages

1️⃣ Searching for Packages

To search for available packages:

dnf search package-name

Example:

dnf search httpd  # Search for Apache HTTP server

2️⃣ Listing Installed Packages

To list all installed packages:

dnf list installed

To check if a specific package is installed:

dnf list installed | grep package-name

πŸ›  Troubleshooting Package Management Issues

1️⃣ Cleaning YUM/DNF Cache

If you encounter issues with package management, clear the cache:

dnf clean all
yum clean all  # Older RHEL versions

2️⃣ Checking for Broken Dependencies

To verify package dependencies:

dnf check
yum check

If issues are found, attempt to fix them:

dnf distro-sync

πŸ” Best Practice: Run dnf history list to review past package operations in case of rollback needs.


πŸ›  Essential Practice for RHCSA

βœ… Install and remove packages using YUM/DNF

βœ… Configure, enable, and disable repositories

βœ… Search and list installed software

βœ… Update and upgrade software securely

βœ… Troubleshoot package management issues effectively


πŸ“Œ Next Article: RHCSA User & Group Management

πŸ“© Subscribe to our blog for more RHCSA tutorials and updates! πŸš€

Read more