Linux Package Management - YUM
YUM
YUM (Yellowdog Updater Modified) is an open source command-line as well as graphical based package management tool for RPM (RedHat Package Manager) based Linux systems.
20 Linux YUM (Yellowdog Updater, Modified) Commands for Package Management
Install a Package with YUM
To install a package called Firefox 14, just run the below command it will automatically find and install all required dependencies for Firefox.
# yum install firefox
Loaded plugins: fastestmirror
Dependencies Resolved
================================================================================================
Package Arch Version Repository Size
================================================================================================
Updating:
firefox i686 10.0.6-1.el6.centos updates 20 M
Updating for dependencies:
xulrunner i686 10.0.6-1.el6.centos updates 12 M
Transaction Summary
================================================================================================
Install 0 Package(s)
Upgrade 2 Package(s)
Total download size: 32 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): firefox-10.0.6-1.el6.centos.i686.rpm | 20 MB 01:10
(2/2): xulrunner-10.0.6-1.el6.centos.i686.rpm | 12 MB 00:52
------------------------------------------------------------------------------------------------
Total 63 kB/s | 32 MB 02:04
Updated:
firefox.i686 0:10.0.6-1.el6.centos
Dependency Updated:
xulrunner.i686 0:10.0.6-1.el6.centos
Complete!
The above command will ask confirmation before installing any package on your system. If you want to install packages automatically without asking any confirmation, use option -y as shown in below example.
# yum -y install firefoxRemoving a Package with YUM
To remove a package completely with their all dependencies, just run the following command as shown below.
Updating a Package using YUM
Let’s say you have outdated version of MySQL package and you want to update it to the latest stable version. Just run the following command it will automatically resolves all dependencies issues and install them.
List a Package using YUM
Use the list function to search for the specific package with name. For example to search for a package called openssh, use the command.
Search for a Package using YUM
If you don’t remember the exact name of the package, then use search function to search all the available packages to match the name of the package you specified. For example, to search all the packages that matches the word .
Get Information of a Package using YUM
Say you would like to know information of a package before installing it. To get information of a package just issue the below command.
List all Available Packages using YUM
To list all the available packages in the Yum database, use the below command.
List all Installed Packages using YUM
To list all the installed packages on a system, just issue below command, it will display all the installed packages.
Yum Provides Function
Yum provides function is used to find which package a specific file belongs to. For example, if you would like to know the name of the package that has the /etc/httpd/conf/httpd.conf.
Check for Available Updates using Yum
To find how many of installed packages on your system have updates available, to check use the following command.
List all available Group Packages
In Linux, number of packages are bundled to particular group. Instead of installing individual packages with yum, you can install particular group that will install all the related packages that belongs to the group. For example to list all the available groups, just issue following command.
Install a Group Packages
To install a particular package group, we use option as groupinstall. Fore example, to install “MySQL Database“, just execute the below command.
Update a Group Packages
To update any existing installed group packages, just run the following command as shown below.
Remove a Group Packages
To delete or remove any existing installed group from the system, just use below command.
List Enabled Yum Repositories
To list all enabled Yum repositories in your system, use following option.
List all Enabled and Disabled Yum Repositories
The following command will display all enabled and disabled yum repositories on the system.
Install a Package from Specific Repository
To install a particular package from a specific enabled or disabled repository, you must use –enablerepo option in your yum command. For example to Install PhpMyAdmin 3.5.2 package, just execute the command.
Interactive Yum Shell
Yum utility provides a custom shell where you can execute multiple commands.
Clean Yum Cache
By default yum keeps all the repository enabled package data in /var/cache/yum/ with each sub-directory, to clean all cached files from enabled repository, you need to run the following command regularly to clean up all the cache and make sure that there is nothing unnecessary space is using. We don’t want to give the output of the below command, because we like to keep cached data as it is.
View History of Yum
To view all the past transactions of yum command, just use the following command.
We have tried to cover all the basic to advance yum commands with their examples. If anything related to yum commands may have missed out. Please update us through our comment box. So, we keep updating the same based on feedback’s received.
Last updated
Was this helpful?