In this process, we will investigate the role of YUM in installing new packages on your server. An important task for every server administrator is the installation of applications and services. There are several different ways to achieve this, but the most effective method involves the YUM package manager. YUM is able to search through any number of repositories, automatically resolve package dependencies, and specify the installation of one or more packages. YUM is a modern and definitive way to install your packages on your server, and it is the purpose of this process to show you how it is done.
To Start With: What Do You Need?
To complete this process, you will require a working installation of the CentOS 7 operating system with root privileges, a console-based text editor of your choice, and a connection to the Internet in order to facilitate the download of additional packages. It’s also good if you have already found some interesting packages to install, which can be learned by using the instructions from the Using YUM to search for packages process.
The Process
This process will show you how to install one or more packages by invoking the YUM installation option. To do this, you will need to log in as the root user and complete the following process:
- To install a single package, replace the package_name value with the appropriate value and type the following:
yum install package_name
- Your system will now provide a transaction report that will require your approval. So, when prompted, simply respond by using the Y or N key and press the Return key to either accept or decline the transaction, as shown as follows:
Is this ok [y/d/N]: y
- If you have declined the transaction, then no further work is required and you will exit the package management routine. However, if you have confirmed the transaction, then watch the progress of your installation, and in the end, it will show you a Complete! Message.
- Congratulations! You now have successfully installed your package of choice.
How Does It Work?
All packages are stored in the RPM package file format, and it is the role of YUM to provide access to those files that are stored in various repositories on the Internet. YUM is the power behind the package management for CentOS and it really does make the installation process very easy, but what have we learned from this experience?
Having invoked the install command, YUM will conduct a search of the various repositories in order to find the relevant headers and metadata associated with the package in question. For example, if you wanted to install a package called wget, you would begin by issuing the install command like so: yum install wget. YUM will then locate the package and generate a transaction summary that will not only indicate the required disk size and expected installation size but will also indicate any necessary dependencies required by the requested package. YUM will then check several different repositories (base, extras, and updates) and, having resolved the need for any necessary
dependencies, YUM will be asking us to confirm the request before continuing with the installation process. So, as you can see, by using the Y key, we will be providing YUM with the permission to fulfill the request, which in turn will result in the download, verification, and installation of the package(s) concerned.
There’s More:
There are times when you may wish to install more than one package at a time. To do this, simply invoke the same install command, but instead of naming a single package, simply identify the full list of packages you may require in such a way that it forms a long shopping list:yum install package_name1 package_name2 package_name3
The number of packages you can install in this way is unlimited, but always leave a single space between each package name and keep the command on a single line. For very long installation instructions, line-wrapping may occur.
You do not need to list the packages in any particular order and the request will be processed in exactly the same way as it was in the original process, and again after listing the transaction summary, it will remain pending until it is confirmed or declined. Again, use the Y key to confirm your request so that the process completes.