If you’re a Linux user, you’re probably familiar with the concept of package management. Package management is the process of installing, updating, and removing software packages on your system. One of the most popular package management tools on Linux is Yum.
In this article, we’ll cover everything you need to know about using Yum to manage packages on your Linux system. We’ll start with a brief overview of Yum, then move on to installation and usage instructions, and finally cover some advanced concepts that will help you get the most out of Yum.
What is Yum?
Yum (short for Yellowdog Updater, Modified) is a package management tool that is used on many Linux distributions, including Red Hat, CentOS, and Fedora. Yum is designed to make it easy to install, update, and remove packages on your system, and it automatically resolves dependencies between packages to ensure that everything works together seamlessly.
Yum is a command-line tool, which means that you’ll need to use the terminal to interact with it. However, once you get the hang of it, Yum is very easy to use, and it can save you a lot of time and effort when it comes to managing packages on your Linux system.
Installing Yum
Before you can start using Yum, you’ll need to make sure that it is installed on your system. Fortunately, Yum is included with most Linux distributions, so you probably won’t need to install it yourself.
To check if Yum is installed on your system, open a terminal and type the following command:
yum --version
If Yum is installed, you should see output that looks something like this:
3.4.3
Installed: rpm-4.11.3-43.el7.x86_64 at 2017-08-30 13:32
Built : CentOS BuildSystem <http://bugs.centos.org> at 2017-06-28 19:42
Committed: Johnny Hughes <johnny@centos.org> at 2017-06-28
Installed: yum-3.4.3-150.el7.centos.noarch at 2017-08-30 13:32
Built : CentOS BuildSystem <http://bugs.centos.org> at 2017-06-28 16:05
Committed: Johnny Hughes <johnny@centos.org> at 2017-06-28
If Yum is not installed, you can install it using the following command:
sudo yum install yum
This will install Yum and any necessary dependencies on your system.
Using Yum
Now that you have Yum installed, you’re ready to start using it to manage packages on your Linux system. Here are some of the most common Yum commands:
Search for Packages
To search for packages using Yum, use the following command:
yum search package_name
For example, if you wanted to search for the Apache web server, you could type:
yum search httpd
This will return a list of packages that match your search criteria, along with a brief description of each package.
Install Packages
To install a package using Yum, use the following command:
sudo yum install package_name
For example, to install the Apache web server, you could type:
sudo yum install httpd
This will download and install the Apache package, along with any necessary dependencies.
Update Packages
To update a package using Yum, use the following command:
sudo yum update package_name
For example, to update the Apache web server, you could type:
sudo yum update httpd
This will download and install any available updates for the Apache package.
Remove Packages
To remove a package using Yum, use the following command:
sudo yum remove package_name
For example, to remove the Apache web server, you could type:
sudo yum remove httpd
This will remove the Apache package from your system, along with any dependencies that are no longer needed.
List Installed Packages
To list all of the packages that are currently installed on your system, use the following command:
yum list installed
This will return a list of all installed packages, along with their version numbers.
Advanced Yum Concepts
Now that you know the basics of using Yum, let’s take a look at some advanced concepts that will help you get the most out of Yum.
Yum Repositories
Yum uses repositories to store packages and their dependencies. A repository is simply a collection of packages that are hosted on a server somewhere on the internet. By default, Yum is configured to use the official repositories for your Linux distribution, but you can also add additional repositories to your system to access additional packages.
To add a repository to your Yum configuration, you’ll need to create a new repository file in the /etc/yum.repos.d/
directory. The file should have a .repo
extension, and it should contain information about the repository, including its name, URL, and any required authentication credentials.
Here is an example repository file that you could use to add the EPEL repository to your Yum configuration:
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=https://download.fedoraproject.org/pub/epel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
Once you’ve created a new repository file, you can use Yum to search for and install packages from that repository just like you would with the official repositories.
Yum Groups
Yum groups are collections of packages that are related to a particular task or function. For example, there might be a group of packages for web development, or a group of packages for system administration.
To view a list of available Yum groups, use the following command:
yum grouplist
This will return a list of all available groups, along with a brief description of each group.
To install a Yum group, use the following command:
sudo yum groupinstall group_name
For example, to install the “Development Tools” group, you could type:
sudo yum groupinstall "Development Tools"
This will install all of the packages in the “Development Tools” group, along with any necessary dependencies.
Yum Plugins
Yum plugins are optional extensions that can be installed to add additional functionality to Yum. There are many Yum plugins available, including plugins for caching packages, managing package priorities, and more.
To view a list of available Yum plugins, use the following command:
yum list available | grep yum-plugin
This will return a list of all available Yum plugins.
To install a Yum plugin, use the following command:
sudo yum install yum-plugin-name
For example, to install the “fastestmirror” plugin, you could type:
sudo yum install yum-plugin-fastestmirror
This will install the “fastestmirror” plugin, which will automatically select the fastest mirror to download packages from.
Conclusion
Yum is a powerful and flexible package management tool that can help you keep your Linux system up-to-date and running smoothly. By following the instructions in this article, you should now have a good understanding of how to use Yum to search for, install, update, and remove packages on your system.
Remember, Yum is just one of many package management tools available on Linux, so if you find that Yum doesn’t meet your needs, you can always try out a different tool. However, for most users, Yum is a great choice that provides an easy-to-use interface and powerful functionality.