RHCSA Software Management & System Updates
π 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! π