Table of Contents
- What is a YUM Package manager and its purposes?
- Most Popular YUM Commands and Arguments
- Hints and Tips for YUM Package Manager Users
- YUM, RPM, and DNF Main Differences
In the fast-moving world of development and solid product support, it is crucial to set up, update, and maintain infrastructure in a prompt, reliable, and secure way. Luckily, there are package management systems that can lend a helping hand. In this article, we’ll look at one of the most popular package management systems, YUM, which was developed for the Red Hat family of Linux distributions.
Packagecloud is a software package distribution cloud-based service. Package distribution is performed in a secure, reliable, and unified way that allows companies to decrease infrastructure costs and the time needed for machine set up.
Packagecloud provides package distributions across your company's machines containing different packages in a centralized repository that equips users with everything they need to set up, update, and maintain machines in a fast and flawless way.
Sign up for the packagecloud free trial to get your machines set up and updated easily!
What is a YUM Package manager and its purposes?
YUM (Yellowdog Updater Modified) package manager is a free open source front-end to RPM package manager and provides enhanced capabilities. YUM package manager allows us to obtain information about accessible repositories and available packages, fetch packages from repos, install and uninstall packages, and update the whole system to the latest version.
YUM fulfills dependency resolution. This means that, during installing, updating, and removing packages, YUM automatically detects and installs, updates, and removes all available dependent packages.
It is a general recommendation to work with .rpm packages only while using the YUM package manager. RPM packages were developed for Red Hat family Linux distros like Fedora, CentOS, and RedHat Enterprise Linux. These packages contain precompiled software and metadata with software descriptions and information about dependent packages. An .rpm package is generally delivered as a single file and has one of the following file name formats:
<name>-<version>-<release>.src.rpm for source packages
<name>-<version>-<release>.<architecture>.rpm for binaries
Packages are collected centrally and stored in repositories on the Internet or locally, performing like mirrors or collecting useful packages for a company's particular needs.
YUM ensures secure package management by enabling GNU privacy guard signature verification (GPG). This means that only trusted packages from trusted repositories can be installed by YUM when this option is enabled in configuration files.
Packagecloud provides efficient tools to organize trusted cloud-based repos and enables users to reliably and securely set up and update machines without owning any of the infrastructure that is typically required to do that.
Check out the packagecloud free trial to see how easy it is to distribute packages throughout your entire organization.
Most Popular YUM Commands and Arguments
Let’s explore some of the base commands and arguments for working with the YUM command line. It should be noted you must obtain superuser privilege to use YUM to install and update packages or uninstall packages from the system.
To install a single package and all its uninstalled dependencies, run the following command:
yum install package_name.
Let’s look at the installation process. Execute as root to install and update the latest HTTPd package.
The following screenshots were taken from the official Red Hat site.
YUM uploads required plugins and executes transaction checks. In this example, the HTTPd package is already installed, and it will be updated to the latest currently available version.
The same actions are applied to dependency HTTP tools.
After that, a transaction summary is presented.
You are prompted to confirm the installation. Besides the installation confirmation, you can choose the ‘d’ option to download the package to your local machine and not install it directly.
If you want to avoid the confirmation process during package installation, as well as the package removing or updating process, just add the argument -y to the command to automatically confirm performing actions: yum -y install package_name.
To remove a particular package and all its dependencies, run the following command: yum remove package_name.
You can remove several packages at once by adding package names to the command. Similar to install, the remove command can take package names and glob expressions.
To update the particular package and all its dependencies, run the following command as root: yum update package_name.
To list information about all installed and available packages, run the following command: yum list all.
To get information about specific packages, run the following command: yum list package_name.
To list all available packages, run this command: yum list | less.
To list all installed packages, use the following command: yum list installed | less.
If you don’t remember the exact package name, you can use the command yum search term with the term as an argument. YUM returns results as a list of the packages that match the query term and their summary.
Information About Package
To view information about one or more packages, run the following command: yum info package_name. You can use glob expressions as well to get the package description.
To see available updates for installed packages in your system, use the following command: yum check-update.
To update all packages in the system and their dependencies, run this command: yum update.
If you want to update security-related packages only, issue the following command: yum update --security.
Listing YUM Repositories
To view all available repositories in your system with information about id, name, and the number of packages for each repository, use the following: yum repolist. The command yum repolist all displays all disabled and enabled repositories in your system.
Clean YUM Cache
To clean all cached files after package installation and to free up space, you can run the command yum clean all. You can create a cron job to perform this process automatically.
To view information about yum transactions, date of transaction, the number of packages involved in a transaction, results of these transactions, or RPM database changes, you can run the command yum history.
Hints and Tips for YUM Package Manager Users
The following tips and hints will help you to work with the YUM package manager more efficiently and securely.
Work with group packages
In Linux, packages related to a particular field are bundled into the group. YUM provides a great opportunity to work with groups. To view installed and available group packages, run the command yum group list.
To view info about a particular group, use the command yum ‘group_name’ info with the group name.
To install group packages, just run this command from the root: yum group install ‘group_name’. You often need to put the group name in quotes because, generally, the group name consists of two words.
To remove a group of packages from the system, use the following command: yum group remove ‘group_name’. For group installing or removing. you can point to the particular group by adding the group id to the command yum group install groupid.
Use YUM plugins
To extend YUM usage, there is a plugin management system that allows developers to add functionality to the core YUM performance.
Skip broken dependencies
The skip-broken plugin allows you to automatically skip deprecated dependencies and linked packages that are no longer compatible with the required packages.
Sometimes a new software version doesn’t work properly or does not cover your needs adequately. There is a great opportunity provided by the YUM package manager to downgrade to the previous version.
YUM, RPM, and DNF Main Differences
When compared to the RPM package manager, YUM has the same functionality. The main difference between these two package managers is the ability to automatically resolve dependencies efficiently by YUM.
In YUM, you don’t need to explicitly point to package sources like in RPM. All you need is the name of the required package while running the command.
The YUM package system allows you to upgrade your entire system to the latest available version by setting up an auto-upgrade to all updates in your machine by using the yum-cron service. You can configure the yum-cron service to run cron jobs to check updates every hour or every day in configuration files.
The DNF (Dandified YUM) package manager is also used to manage packages on rpm-based systems (RedHat, Fedora, CentOS, Open SUSE, and Oracle Linux). The DNF package manager replaced YUM in the latest RedHat family Linux distros due to several core advantages. Written in C, C++, and Python and developed from scratch, the DNF package manager provides more efficient dependency resolution based on the “libsolv” library developed by SUSE (an open-source software company). The DNF package manager ensures more productive memory usage and dependency resolution of repository metadata performance. Unlike the YUM package manager, the DNF one has full and well-written API documentation that allows the creation of new features easily.
Packagecloud is a cloud-based service for distributing software packages to your machines and environments. Packagecloud enables users to keep all of the packages in one repo that are required by their organization, regardless of OS or programming language, and repeatedly distribute them to their destination machines.
This provides system administrators and developers the ability to efficiently, reliably, and securely set up and update machines without owning any of the infrastructure typically required to do that.
Try the packagecloud free trial to see how easy it is to distribute packages throughout your entire organization. Never be concerned about the scaling, stability, or security of your packages again.
Learning YUM package manager commands and its use grants fast system administration tasks performance. YUM has great potential compared to the RPM package manager but loses to DNF in functionality.