The package manager is one of the essential components of the system. With them, we can install packages that often contain the applications we need for daily work. It is practically impossible to conceive of an operating system without a package manager. So, obviously, CentOS 7 has one. In this article, ideal for novices, we will teach you how to use YUM the CentOS 7 package manager. So, this way you will be able to take full advantage of this utility.
YUM (Yellowdog updater modifier) is the current CentOS package manager. It is an open source tool that allows us to install, remove, search and manage the packages in our CentOS 7 distribution. Its code is published under the GPL license so we can examine its source code. YUM is to CentOS what APT is to Debian or Ubuntu.
It should be noted that a package manager is a key component of a Linux system. It allows us to install the necessary packages for our daily work with applications. However, the main advantage of package managers is the management of the dependencies of a given package. For example, if we want to install a package A that depends on a package B, YUM and any other package manager will resolve this issue by installing package B automatically. Of course, there are times when the package manager cannot resolve the dependencies and we will have to act.
On the other hand, package managers today can search for packages and in some cases manage repositories.
How to use the CentOS package manager
The use of YUM, as well as other package managers, is very simple. Just use the command with the options and parameters. So it will not be difficult for you to understand. However, one thing to keep in mind is that root privileges are required. It is obvious if we take into account that with YUM we can install and uninstall packages that are often applications.
So open a terminal or access your CentOS 7 server and run:
Normally the first thing we do is update all the packages installed in our system. To do this, run:
:~# yum update
It is also possible to update all packages except one that we specify.
:~# yum update --exclude=[package_name]
Or specify which package or packages we want to update.
:~# yum update [package_name] [package_name]
Also, you can check which packages can be updated without starting the process.
:~# yum check-update
Once you have typed these commands, you will be asked to confirm whether you really want to make these changes. However, if you do not want confirmation to be asked you can add the option -y before update.
Next, we will always need to install some package. With YUM it is very simple:
:~# yum install [package_name]
Of course, you can install several packages in a single command:
:~# yum install [first_package] [second_package] ...
Now, sometimes, it is convenient to know how to uninstall the packages.
:~# yum remove [package_name]
As in the installation process, you can uninstall several packages at once.
:~# yum remove [package_name] [package_name] ...
Search and print package information
With YUM we cannot only update, install and uninstall packages, we can also look for information about some of them.
:~# yum info [package_name]
Or, show information of all available packages to update.
:~# yum info available
On the other hand, you can search for a specific package. Ideal if you do not remember the exact name of the package.
:~# yum list | grep [package_name]
:~# yum search [package]
If you want to show all packages, installed or not, the command is as follows:
:~# yum list
So, if you only want to see the installed ones
:~# yum list installed
Or, the packages ready to be updated.
:~# yum list updates
YUM cleaning options and list the repositories
Every time we install a package, YUM downloads it, so it is a good idea to wipe the package cache to save disk space.
:~# yum clean packages
To do a deep cleaning, you can use this command:
:~# yum clean all
Finally, you can see all the active repositories by typing this command:
:~# yum repolist
So, now you can enjoy it.
To manage a package manager in a good way is a guarantee to be able to use our system better. So YUM, the CentOS package manager, is characterized by its ease of use and low learning curve.
This article is for people without much knowledge of CentOS so help us to reach many people who need it.