Home CentOS How to manage Packages on CentOS with YUM

How to manage Packages on CentOS with YUM

by Kiran Kumar
Published: Updated:
manage packages with yum on Centos

Every Linux distribution has a way to manage software packages. Besides installing software by compiling it from the source, CentOS uses two package management commands: a low-level RPM and a high-level YUM command.

If you ever wondered what YUM stands for, it is an abbreviation for Yellow Dog Updater, Modified. It is a high-level package manager that uses the RPM package management tool in the background. So, how it differs from RPM? I will show you in a minute.

Installing Packages using YUM on CentOS

For the sake of illustration, let’s install a package called httpd, which is an Apache web server. We will use yum install httpd as follows:

yum install httpd

Once you issue that command, a lot of text goes by and you are prompted to press ‘y’ to proceed.


Accepting installation

Before you do, take a look at the above text: you can see the package name, it’s architecture, version, repository, and size. Also, you can see that it is installing five other packages as dependencies, totaling 6 installed packages.

RPM vs YUM: When you install a package via RPM, you may have to need some other packages. These are called dependencies. It can sometimes lead to dependency hell, because for example package_a have dependency called package_b, and package_b, in turn, have package_c as the dependency. Package_c can have, you guessed, package_d as dependency and so on.
So we need to download not only package_a but also package_b,package_c and so on. Some package may require as many as 100 dependencies. An additional problem is that we need to install the exact version of the dependency package, that matches the man package. YUM takes care of all of that.

Press y, and once again, and it is finished.


Installation finished

A helpful tip: if you are sure what you are doing then you can automatically accept everything by using -y switch to yum command. For example:

yum -y install httpd


Repositories are locations on the internet where all the packages are stored. These are obviously configured somewhere. In CentOS, repositories are stored as files in /etc/yum.repos.d folder. We can take a look at its contents.

CentOS-Base.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Vault.repo

All there repositories(or “repos”), defined with files ending with .repo are already configured when we install minimal CentOS.

In CentOS 6, we don’t need to manage packages with yum to download an rpm package, because it is available in the default repositories. So let’s try to install it via yum. Example:

yum -y install epel-release

Now let’s see the contents of /etc/yum.repos.d/ again.

ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Vault.repo epel.repo epel-testing.repo

We can see new files epel.repo and epel-testing.repo. They define repository with hundreds of additional packages for CentOS, RedHat, Scientific Linux and few other clones of RedHat. There is even a way to show all repos and a number of packages they contain with one yum command, yum repolist.

yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.t-2.net
* epel: mirrors.netix.net
* extras: centos.t-2.net
* updates: centos.t-2.net
repo id repo name status
base CentOS-6 - Base 6,713
epel Extra Packages for Enterprise Linux 6 - x86_64 12,506
extras CentOS-6 - Extras 43
updates CentOS-6 - Updates 319
repolist: 19,581

You can see here that epel repository contains amazing 12,514 packages.

Listing installed packages

I showed you in my RPM article how to list installed packages, with rpm -qa. You can also list these with yum, using list installed options.

yum list installed

Listing installed packages

Its output is a bit different than the one obtained by the rpm command. It’s up to you to decide which one to use.

Removing Packages

Removing the package is easy, just use erase option when using yum, followed by a package name.

yum erase -y epel-release

Similar to RPM, you don’t have to specify the version of the package, just the name of the package.

Let’s install it again because we will need it again in the article.

yum -y install epel-release

Searching for Packages

You can search for packages from the installed repositories using search options, followed by a pattern. It will search only package name and summary, but if there isn’t a match, it will search in the description and URL. For example, to search for packages that have httpd in their name/summary/description/URL, you should type:

yum search httpd

A lot of packages show some of these don’t have httpd in the package name. Instead, you will see it in the description, for example, mod_auth_mellon.


Searching for httpd with yum

You may have noticed that the search is case insensitive, so you don’t have to worry whether you are looking for httpdHttpd or HTTPD.

Retrieve Package Information

Before installation, we can get more information about a certain package by using yum search followed by the package name. Let’s try it with httpd package.

yum info httpd

This shows about every information: its name, architecture, exact version and release, size, and also such things such as from which repo it was installed.

It will show only information about the package exactly called httpd. Since it can produce multiple results, and we want information about all packages that start with httpd, we can use a wild character as well.

yum info httpd*


After a long period where RPM was the prevailing way of installing software, yum is today the preferred way to install software on RedHat compatible Linux operating systems.

YUM was always available, but versions that could be installed out-of-the-box were mostly deprecated. Today, software producers often offer newer versions using yum by means of installing repository via .rpm file. Therefore, for example, if you want to install the newest PHP package, we install a repository that offers that specific version of PHP. Yum is today more powerful than ever, and by getting to know it better, you can make your Linux management much easier.

You may also like

Leave a Comment



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us


©2016-2023 FOSS LINUX



“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.