Yum Command on Linux (Installing and Upgrading Packages)
Linux distributions based on Red Hat use the package manager called Red Hat Package Manager — RPM to install your software. The most famous distributions include Red Hat’s own Linux Enterprise, Fedora, and CentOS.
RPM is a powerful package manager that allows the administrator to install, remove, and obtain package information. It is a software distribution method widely used in several Linux distributions, in addition to Red Hat.
It also makes it possible to build packages from source files, verify the digital signature, simulate an installation, among others. It’s as powerful as dpkg and apt-get.
Due to the difficulty of dealing with package management using the rpm command, Red Hat-based Linux distributions use the yum utility.
Yum is an acronym for Yellow Dog Updater, Modified. It is a tool used to manage the installation and removal of packages in Linux distributions that use the RPM system.
Yum is a file package manager similar to APT-GET that automatically handles dependencies by computing them and resolving what must be done to treat them.
It has a configuration file that specifies which repositories YUM should use to search for and download RPM packages.
RPM-based Linux won’t always have the YUM package manager installed. If you need to install YUM, it can be obtained at http://yum.baseurl.org.
The installation command is:
Some yum commands:
- yum list: List all available packages;
- yum check-update or yum list updates: Check if there are packages available for an update;
- yum update: Update your system;
- yum install ;: Installs a specific package and its dependencies;
- yum remove: Removes a specific package
- yum info: Presents basic information for a given package.
- yum whatprovides file: List all packages that have the file indicated in the search
See the examples:
To install a package:
One option in Yum is the “-y” that installs or updates packages without asking. It’s not very suitable for production.
To update installed packages:
To remove a package:
To search for all packages with the word “firefox”:
To obtain information about a particular package:
To view all the packages available in the yum repository:
To find out which package a particular file belongs to:
To find out which repositories are active in YUM:
Like apt, YUM also caches packages downloaded in the /var/cache/yum directory.
Generally, after the successful installation of the packages, yum automatically cleans the cache directory. This depends on the /etc/yum.conf configuration file, especially the keepcache option.
In any case, you can empty the cache with the command:
Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.