YUM Commands for Package Management

 

 

 

 

In this article , we will learn how to install, update,remove,find packages, manage packages and repositories on Linux system using YUM (Yellowdog Updater Modified) tool developed by RedHat. The basic requirement of this article is ,you must have a basic understanding of commands and a working Linux operating system.

 

What is 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. It allows users and system administrator to easily install ,update, remove or search software packages on a systems. It was developed and released by Seth Vidal under GPL( General Public License) as an open source.

 

1. Install a Package with YUM

To install a package called  Firefox, just run the below command it will automatically find and install 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 packages 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

 

2. Removing a Package with YUM

To remove a package completely with their all dependencies,

 

# yum remove firefox
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package firefox.i686 0:10.0.6-1.el6.centos set to be erased
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================
Package Arch Version Repository Size
====================================================================================================
Removing:
firefox i686 10.0.6-1.el6.centos @updates 23 M
Transaction Summary
====================================================================================================
Remove 1 Package(s)
Reinstall 0 Package(s)
Downgrade 0 Package(s)
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : firefox-10.0.6-1.el6.centos.i686 1/1
Removed:
firefox.i686 0:10.0.6-1.el6.centos
Complete!

 

3. Updating a Package using YUM

To update particular package using yum by following command

# yum update mysql
Loaded plugins: fastestmirror
Dependencies Resolved
============================================================================================================
Package Arch Version Repository Size
============================================================================================================
Updating:
vsftpd i386 2.0.5-24.el5_8.1 updates 144 k
Transaction Summary
============================================================================================================
Install 0 Package(s)
Upgrade 1 Package(s)
Total size: 144 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : vsftpd 1/2
Cleanup : vsftpd 2/2
Updated:
vsftpd.i386 0:2.0.5-24.el5_8.1
Complete!

 

4. List a Package using YUM

Using the list command to search for a specific package with name.

# yum list openssh
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.neu.edu.cn
* epel: mirror.neu.edu.cn
* extras: mirror.neu.edu.cn
* rpmforge: mirror.nl.leaseweb.net
* updates: mirror.nus.edu.sg
Installed Packages
openssh.i386                                            4.3p2-72.el5_6.3 installed
Available Packages                                      4.3p2-82.el5 base

 

5. Search for a Package using YUM

If you don’t remember the exact name of the package , then use search command to search all the available packages.

# yum search vsftpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.neu.edu.cn
* epel: mirror.neu.edu.cn
* extras: mirror.neu.edu.cn
* rpmforge: mirror.nl.leaseweb.net
* updates: ftp.iitm.ac.in
============================== Matched: vsftpd ========================
ccze.i386 : A robust log colorizer
pure-ftpd-selinux.i386 : SELinux support for Pure-FTPD
vsftpd.i386 : vsftpd - Very Secure Ftp Daemon

6. Get information of a Package using YUM

To get the information about particular package

# yum info firefox
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.neu.edu.cn
* epel: mirror.neu.edu.cn
* extras: mirror.neu.edu.cn
* rpmforge: mirror.nl.leaseweb.net
* updates: ftp.iitm.ac.in
Available Packages
Name : firefox
Arch : i386
Version : 10.0.6
Release : 1.el5.centos
Size : 20 M
Repo : updates
Summary : Mozilla Firefox Web browser
URL : http://www.mozilla.org/projects/firefox/
License : MPLv1.1 or GPLv2+ or LGPLv2+
Description: Mozilla Firefox is an open-source web browser, designed for standards
: compliance, performance and portability.

7. Check for Available Updates using YUM

To check how many of installed packages on your system have updates available.

# yum check-update

 

8. Update System using YUM

To keep your system up-to-date with all security and binary packages updates, run the following command.

# yum update

9. YUM Provides Function

YUM provides command is used to find which packages a specific file belongs to.

# yum  provides firefox

10. List all enabled and disabled YUM Repositories

# yum repolist all

Leave a Reply

Your email address will not be published. Required fields are marked *