YUM (Yellowdog Updater Modified) is an open source command-line as well as graphical based package management tool for RPM based Linux systems.
Yum is the standard method of managing the installation and removal of software. YUM uses numerous third party repositories to install packages automatically by resolving their dependencies issues.
Yum will work only from Centos 5/ Red hat 5 and latest versions of fedora. For old releases like RHEL 4you need to use up2date command to update your rpm based packages. Yum uses configuration file at /etc/yum.conf
Install a Package with YUM
To install a package called Firefox, just run the below command it will automatically find and install all required dependencies for Firefox.
# yum install firefox
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 firefox
Removing a Package with YUM
To remove a package completely with their all dependencies, just run the following command as shown below.
# yum remove firefox
Above command will ask confirmation before removing a package. To disable confirmation prompt just add option -y as shown in below.
# yum -y remove firefox
Updating a Package using YUM
If 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.
# yum update mysql
To install a package locally from directory or cd rom.
# yum localinstall finger-0.17-39.el6.i686.rpm
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.
# yum list openssh
To search a specific version openssh-4.3p2 of the package, use the command.
# yum list openssh-4.3p2
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 .
# yum search vsftpd
If you would like to know information of a package before installing it, just run the below command.
# yum info firefox
List all available packages using YUM
To list all the available packages in the Yum database, use the below command.
# yum list | less
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 list installed | less
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.
# yum provides /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.
# yum check-update
Update System using Yum
To keep your system up-to-date with all security and binary package updates, run the following command. It will install all latest patches and security updates to your system.
# yum update
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.
# yum grouplist
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.
# yum groupinstall 'MySQL Database'
Update a Group Packages
To update any existing installed group packages, just run the following command as shown below.
# yum groupupdate 'DNS Name Server'
Remove a Group Packages
To delete or remove any existing installed group from the system, just use below command.
# yum groupremove 'DNS Name Server'
List enabled Yum Repositories
To list all enabled Yum repositories in your system, use following option.
# yum repolist
List all enabled and disabled Yum Repositories
The following command will display all enabled and disabled yum repositories on the system.
# yum repolist all
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.
# yum --enablerepo=epel install phpmyadmin
Interactive Yum Shell
Yum utility provides a custom shell where you can execute multiple commands.
# yum shell
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.
# yum clean all
View History of Yum
To view all the past transactions of yum command, just use the following command.
# yum history