YUM (Yellowdog Updater, Modified) is a powerful package management tool that simplifies the process of installing, updating, and removing software on Linux systems. Primarily used in Red Hat-based distributions (such as CentOS, RHEL, Fedora, and Oracle Linux), YUM helps administrators manage software packages with ease.
This guide will show you how to install YUM on a Linux server, configure it, and leverage its features to maintain a secure and efficient system.
What is YUM?

YUM is a command-line package manager for Red Hat-based Linux distributions. It automatically handles dependencies, ensuring that all required libraries and files are installed when you add or update software. With YUM, you can easily manage software packages, perform system updates, and install new software, all while keeping track of installed versions and patches.
Key features of YUM include:
- Dependency Resolution: Automatically resolves dependencies when installing or updating software packages.
- Repository Management: YUM interacts with repositories, central storage for software packages, to download and install software.
- Ease of Use: Simple commands for installing, updating, and removing packages.
Now, let’s dive into how to install YUM on your Linux server and get started with using it.
Why Install YUM on a Linux Server?
Installing YUM on your Linux server can greatly simplify system management. Here are some reasons why YUM is essential:
- Ease of Package Management: YUM simplifies installing, updating, and removing software packages without needing to manually handle dependencies.
- Centralized Software Management: With YUM, you can manage all software packages through a single interface, making it easier to maintain the system.
- Secure and Up-to-Date Systems: YUM ensures that your system remains up-to-date with security patches and the latest software versions.
- Automatic Updates: YUM can be configured to automatically apply updates, ensuring that the system is always secure and up to date.
In the next sections, we’ll show you exactly how to install YUM and configure it on your Linux server.
Prerequisites
Before you start the installation process, make sure you have the following prerequisites:
- A Linux Server: YUM is specifically designed for Red Hat-based Linux distributions like CentOS, RHEL, Fedora, and Oracle Linux.
- Root or Sudo Privileges: You need administrative access to install and configure YUM.
- Basic Knowledge of Package Management: Understanding how package management works in Linux will help you when using YUM.
Install YUM on Linux Server
YUM is often pre-installed on most Red Hat-based distributions. However, if for some reason it’s not installed, here’s how to install YUM on your system, depending on the Linux distribution you’re using.
Installing YUM on CentOS/RHEL
- Install Required Dependencies:
First, make sure you have all necessary dependencies installed. In most cases, YUM is already included in the CentOS/RHEL distribution, but you can install it manually if needed:
sudo yum install yum
- Verify YUM Installation:
To confirm that YUM is installed and working correctly, use the following command:
yum --version
This should return the version of YUM currently installed on your system.
Installing YUM on Fedora
For Fedora, YUM is gradually being replaced by DNF (Dandified YUM). However, if you are using an older version of Fedora that still uses YUM, the installation steps are similar to those on CentOS/RHEL.
- Install YUM:
sudo dnf install yum
- Verify YUM Installation:
yum --version
Installing YUM on Oracle Linux
Oracle Linux also uses YUM for package management, and YUM is usually installed by default.
- Install YUM:
For Oracle Linux, you can use the following command:
sudo yum install yum
- Verify YUM Installation:
yum --version
Manual Installation Using tar.gz Package
If you’re using a Linux distribution that doesn’t come with YUM pre-installed or you’re encountering issues, you can manually install YUM using a tarball.
- Download the tar.gz package from the official YUM website.
- Extract and Install YUM:
tar -xvzf yum-x.x.x.tar.gz
cd yum-x.x.x
sudo python setup.py install
Configuring YUM Repositories
Once you’ve installed YUM, you need to configure YUM repositories. Repositories store the software packages YUM uses to install or update software. By default, YUM is configured with a set of standard repositories, but you may need to add custom ones.
What Are YUM Repositories?
YUM repositories are storage locations that contain software packages and metadata. YUM downloads these packages to install or update software. You can have multiple repositories, including official and third-party repositories.
Managing YUM Repositories
- Default Repositories: CentOS, RHEL, and Fedora come with pre-configured default repositories.
- Adding Custom Repositories: If you want to add custom or third-party repositories, you need to create
.repo
files in the/etc/yum.repos.d/
directory. For example:
sudo nano /etc/yum.repos.d/custom.repo
- Add the following configuration:
[custom-repo]
name=Custom Repository
baseurl=http://example.com/repo/
enabled=1
gpgcheck=1
gpgkey=http://example.com/repo/RPM-GPG-KEY
- List Enabled Repositories:
To view all enabled repositories, use:
yum repolist
Using YUM for Package Management
With YUM installed and repositories configured, you can now use it for various package management tasks.
Installing Software Packages with YUM
To install software with YUM, use the following command:
sudo yum install package_name
For example, to install Apache, use:
sudo yum install httpd
Updating Installed Packages
To update installed packages, use:
sudo yum update
This will update all installed packages to the latest version available from your repositories.
Removing Software Packages
To remove a package, use:
sudo yum remove package_name
Listing Installed Packages
To list all installed packages on the system, use:
yum list installed
To search for a specific package, use:
yum search package_name
Advanced YUM Usage
YUM Group Installations
You can install a group of related packages by using YUM’s group functionality. For example:
sudo yum groupinstall "Development Tools"
This command installs a group of packages related to development tools.
YUM History and Rollbacks
YUM maintains a history of all installed packages. You can view this history using:
yum history
If needed, you can roll back a specific transaction:
sudo yum history undo transaction_id
Configuring Automatic Updates
To keep your system up to date automatically, configure yum-cron or dnf-automatic to run updates in the background:
sudo yum install yum-cron
Enable it to run at regular intervals:
sudo systemctl enable yum-cron
sudo systemctl start yum-cron
Troubleshooting YUM
Common YUM Errors
- Repository Errors: If you receive errors about repositories, ensure that the URLs in the
.repo
files are correct and that the repositories are accessible. - Dependency Errors: YUM handles dependencies, but if it encounters issues, try running:
sudo yum clean all
sudo yum update
Clearing YUM Cache
If YUM encounters issues due to a corrupted cache, you can clear the cache with:
sudo yum clean all
Checking Package Integrity
If a package fails to install or update correctly, verify its integrity using:
sudo rpm -V package_name
Securing YUM in Linux
Securing Repositories: Ensure that all repositories are accessed securely via HTTPS. If using custom repositories, configure them to use SSL for secure communications.
Limiting YUM Access: Restrict access to YUM on your server by setting file permissions or using access control lists (ACLs) for YUM-related directories.
Periodic Updates: It’s crucial to keep YUM and the repositories updated to protect your server from security vulnerabilities.
Conclusion
Now that you’ve learned how to install YUM on your Linux server, you can leverage its powerful package management features to install, update, and maintain your system’s software. With YUM, managing your server becomes easier and more efficient, ensuring that your software is always up-to-date and secure.
By configuring YUM repositories, using advanced features like group installations and history, and troubleshooting common issues, you can optimize your server management experience. Regular updates and security practices will help keep your system running smoothly and securely.