YUM Command in Linux with Examples
YUM Command
YUM stands for Yellowdog Updater Modified. It is an open-source command line package management tool for Linux systems. It allows the system to easily install, update, remove or search software packages on systems.
Syntax
yum < process to do> < package name>
To install a package
To install a normal package in Linux, just type the package name with the action to be taken as shown below.
Example
[root@linuxhelp ~]# yum install vnc
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package tigervnc.x86_64 0:1.1.0-16.el6.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================
Package Arch Version Repository Size
=====================================================================================
Installing:
tigervnc x86_64 1.1.0-16.el6.centos base 185 k
Transaction Summary
=====================================================================================
Install 1 Package(s)
Total download size: 185 k
.
.
.
.
Installing : tigervnc-1.1.0-16.el6.centos.x86_64 1/1
Verifying : tigervnc-1.1.0-16.el6.centos.x86_64 1/1
Installed:
tigervnc.x86_64 0:1.1.0-16.el6.centos
Complete!
Here, vim package is installed by default yum will install vim with all the dependencies perfectly. -y option is used for all.
To remove a package
[root@linuxhelp ~]# yum remove firefox
Here, it will remove the Firefox package with all their dependencies at a time. As seen before, -y option can be used for avoiding every time confirmations.
To update a package
This yum command is used to update the version of specifying package.
Example
[root@linuxhelp ~]# yum update firefox
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
Setting up Upgrade Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package firefox.x86_64 0:10.0.12-1.el6.centos will be obsoleted
---> Package firefox.x86_64 0:10.0.12-1.el6.centos will be updated
---> Package firefox.x86_64 0:38.6.1-1.el6.centos will be obsoleting
--> Running transaction check
---> Package libvpx.x86_64 0:0.9.0-8.el6_0 will be updated
--> Processing Dependency: libvpx.so.0()(64bit) for package: gstreamer-plugins-bad-free-0.10.19-2.el6.x86_64
---> Package libvpx.x86_64 0:1.3.0-5.el6_5 will be an update
---> Package nss.x86_64 0:3.14.0.0-12.el6 will be updated
--> Processing Dependency: libcrypto.so.10(libcrypto.so.10)(64bit) for package: gstreamer-plugins-bad-free-0.10.19-3.el6_5.x86_64
---> Package nss-softokn.x86_64 0:3.12.9-11.el6 will be updated
---> Package nss-softokn.x86_64 0:3.14.3-23.el6_7 will be an update
--> Processing Dependency: nss-softokn-freebl(x86-64) > = 3.14.3-23.el6_7 for package: nss-softokn-3.14.3-23.el6_7.x86_64
---> Package nss-sysinit.x86_64 0:3.14.0.0-12.el6 will be updated
---> Package nss-sysinit.x86_64 0:3.19.1-8.el6_7 will be an update
---> Package nss-tools.x86_64 0:3.19.1-8.el6_7 will be an update
--> Running transaction check
---> Package nss-softokn-freebl.x86_64 0:3.12.9-11.el6 will be updated
---> Package nss-softokn-freebl.x86_64 0:3.14.3-23.el6_7 will be an update
---> Package openssl.x86_64 0:1.0.0-27.el6 will be updated
Dependencies Resolved
================================================================================
Package Arch Version Repository
Size
================================================================================
Installing:
firefox x86_64 38.6.1-1.el6.centos updates 70 M
replacing firefox.x86_64 10.0.12-1.el6.centos
Updating for dependencies:
gstreamer-plugins-bad-free x86_64 0.10.19-3.el6_5 base 836 k
libvpx x86_64 1.3.0-5.el6_5 base 486 k
nss x86_64 3.19.1-8.el6_7 updates 857 k
nss-softokn x86_64 3.14.3-23.el6_7 updates 262 k
nss-softokn-freebl x86_64 3.14.3-23.el6_7 updates 167 k
nss-sysinit x86_64 3.19.1-8.el6_7 updates 46 k
nss-tools x86_64 3.19.1-8.el6_7 updates 434 k
openssl x86_64 1.0.1e-42.el6_7.2 updates 1.5 M
Transaction Summary
================================================================================
Install 1 Package(s)
Upgrade 8 Package(s)
Total size: 74 M
.
.
.
.
Dependency Updated:
gstreamer-plugins-bad-free.x86_64 0:0.10.19-3.el6_5 libvpx.x86_64 0:1.3.0-5.el6_5 nss.x86_64 0:3.19.1-8.el6_7
nss-softokn.x86_64 0:3.14.3-23.el6_7 nss-softokn-freebl.x86_64 0:3.14.3-23.el6_7 nss-sysinit.x86_64 0:3.19.1-8.el6_7
nss-tools.x86_64 0:3.19.1-8.el6_7 openssl.x86_64 0:1.0.1e-42.el6_7.2
Replaced:
firefox.x86_64 0:10.0.12-1.el6.centos
Complete!
If the Firefox package is outdated and it needs to be updated to latest stable version, just run the command with ' update' option.
To list the available packages
Example
[root@linuxhelp ~]# yum list tigervnc
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
Installed Packages
tigervnc.x86_64 1.1.0-16.el6.centos @base
With this command, the available packages are listed that belongs to ‘ tigervnc’ . To search more accurate, define the package name with their version. While listing the package it will also intimate whether it is installed or not in our system.
To search a package
If the exact name of the package is not known, then search option is used. For example, in ' tigervnc' you remember only ' vnc' just type vnc and search in command.
Example
[root@linuxhelp ~]# yum search vnc
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
================================ N/S Matched: tigervnc ==========================================
tigervnc.x86_64 : A TigerVNC remote display system
tigervnc-server.x86_64 : A TigerVNC server
tigervnc-server-applet.noarch : Java TigerVNC viewer applet for TigerVNC server
tigervnc-server-module.x86_64 : TigerVNC module to Xorg
Name and summary matches only, use " search all" for everything.
Here, it shows the available packages named as fox. From there you can select the required package.
To get the information of a package
Example
[root@linuxhelp ~]# yum info tigervnc
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
Installed Packages
Name : tigervnc
Arch : x86_64
Version : 1.1.0
Release : 16.el6.centos
Size : 439 k
Repo : installed
From repo : base
Summary : A TigerVNC remote display system
URL : http://www.tigervnc.com
License : GPLv2+
Description : Virtual Network Computing (VNC) is a remote display system which
: allows you to view a computing ' desktop' environment not only on the
: machine where it is running, but from anywhere on the Internet and
: from a wide variety of machine architectures. This package contains a
: client which will allow you to connect to other desktops running a VNC
: server.
It returns the information of the ‘ tigervnc’ package.
Available packages
To list all available packages in Yum database,
Example
[root@linuxhelp ~]# yum list
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
Installed Packages
ConsoleKit.x86_64 0.4.1-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4
ConsoleKit-libs.x86_64 0.4.1-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4
ConsoleKit-x11.x86_64 0.4.1-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4
DeviceKit-power.x86_64 014-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4
.
.
.
zlib-static.x86_64 1.2.3-29.el6 base
zsh.x86_64 4.3.11-4.el6.centos.1 updates
zsh-html.x86_64 4.3.11-4.el6.centos.1 updates
Installed packages
To list all installed packages in system,
Example
[root@linuxhelp ~]# yum list installed
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
Installed Packages
ConsoleKit.x86_64 0.4.1-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4
ConsoleKit-libs.x86_64 0.4.1-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4
ConsoleKit-x11.x86_64 0.4.1-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4
DeviceKit-power.x86_64 014-3.el6 @anaconda-CentOS-201303020151.x86_64/6.4
.
.
.
zd1211-firmware.noarch 1.4-4.el6 @anaconda-CentOS-201303020151.x86_64/6.4
zenity.x86_64 2.28.0-1.el6 @anaconda-CentOS-201303020151.x86_64/6.4
zip.x86_64 3.0-1.el6 @anaconda-CentOS-201303020151.x86_64/6.4
zlib.x86_64 1.2.3-29.el6 @anaconda-CentOS-201303020151.x86_64/6.4
Options
' Provides' function is used to find which package specific file is belonging to.
For example, if you want to know name of the package that has ' /etc/httpd/conf/httpd.conf'
Example
[root@linuxhelp ~]# yum provides /etc/httpd/conf/httpd.conf
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
httpd-2.2.15-47.el6.centos.3.x86_64 : Apache HTTP Server
Repo : updates
Matched from:
Filename : /etc/httpd/conf/httpd.conf
.
.
.
httpd-2.2.15-26.el6.centos.x86_64 : Apache HTTP Server
Repo : installed
Matched from:
Other : Provides-match: /etc/httpd/conf/httpd.conf
Enabled Yum repositories
To list all enabled Yum repositories in your system,
Example
[root@linuxhelp ~]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
repo id repo name status
base CentOS-6 - Base 6,575
extras CentOS-6 - Extras 50
updates CentOS-6 - Updates 1,231
repolist: 7,856
To list all enabled as well as disabled repositories on the system
It will display all the repositories in the system either it is enabled or disabled.
Example
[root@linuxhelp ~]# yum repolist all
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
repo id repo name status
C6.0-base CentOS-6.0 - Base disabled
C6.0-centosplus CentOS-6.0 - CentOSPlus disabled
C6.0-contrib CentOS-6.0 - Contrib disabled
.
.
.
C6.3-updates CentOS-6.3 - Updates disabled
base CentOS-6 - Base enabled: 6,575
c6-media CentOS-6 - Media disabled
centosplus CentOS-6 - Plus disabled
contrib CentOS-6 - Contrib disabled
debug CentOS-6 - Debuginfo disabled
extras CentOS-6 - Extras enabled: 50
updates CentOS-6 - Updates enabled: 1,231
repolist: 7,856
To check for available update
Using this command we can check for the latest update is available or not. If a latest update is available it will show the particular package.
Example
[root@linuxhelp ~]#yum check-update
ModemManager.x86_64 0.4.0-5.git20100628.el6 base
NetworkManager.x86_64 1:0.8.1-99.el6 base
NetworkManager-glib.x86_64 1:0.8.1-99.el6 base
Net
.
.
.
libreoffice-presenter-screen.x86_64 1:3.4.5.2-16.1.el6_3 @anaconda-CentOS-201303020151.x86_64/6.4
sssd-common.x86_64 1.12.4-47.el6_7.7 updates
libsss_autofs.x86_64 1.9.2-82.el6 @anaconda-CentOS-201303
To list all available Group Packages
It will list all the available grouped packages.
Example
[root@linuxhelp ~]#yum grouplist
Installed Groups:
Additional Development
Base
Debugging Tools
Desktop
Desktop Debugging and Performance Tools
Desktop Platform
.
.
.
Xhosa Support [xh]
Zulu Support [zu]
Done
To install a group packages
If you are known with the group packages, then you can install it using group install option.
Example
[root@linuxhelp ~]#yum groupinstall ' Load Balancer'
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
ipvsadm x86_64 1.26-4.el6 base 42 k
piranha x86_64 0.8.6-4.el6_5.2 base 624 k
Installing for dependencies:
php x86_64 5.3.3-46.el6_7.1 updates 1.1 M
php-cli x86_64 5.3.3-46.el6_7.1 updates 2.2 M
php-common x86_64 5.3.3-46.el6_7.1 updates 529 k
Transaction Summary
================================================================================
Install 5 Package(s)
Total download size: 4.5 M
Installed size: 18 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): ipvsadm-1.26-4.el6.x86_64.rpm | 42 kB 00:00
(2/5): php-5.3.3-46.el6_7.1.x86_64.rpm | 1.1 MB 00:03
(3/5): php-cli-5.3.3-46.el6_7.1.x86_64.rpm | 2.2 MB 00:19
(4/5): php-common-5.3.3-46.el6_7.1.x86_64.rpm | 529 kB 00:01
(5/5): piranha-0.8.6-4.el6_5.2.x86_64.rpm | 624 kB 00:01
--------------------------------------------------------------------------------
Total 159 kB/s | 4.5 MB 00:28
.
.
.
Verifying : piranha-0.8.6-4.el6_5.2.x86_64 1/5
Verifying : ipvsadm-1.26-4.el6.x86_64 2/5
Verifying : php-cli-5.3.3-46.el6_7.1.x86_64 3/5
Verifying : php-5.3.3-46.el6_7.1.x86_64 4/5
Verifying : php-common-5.3.3-46.el6_7.1.x86_64 5/5
Installed:
ipvsadm.x86_64 0:1.26-4.el6 piranha.x86_64 0:0.8.6-4.el6_5.2
Dependency Installed:
php.x86_64 0:5.3.3-46.el6_7.1 php-cli.x86_64 0:5.3.3-46.el6_7.1
php-common.x86_64 0:5.3.3-46.el6_7.1
Complete!
To remove a group packages
Example
[root@linuxhelp ~]#yum groupremove ' Load Balancer'
Dependencies Resolved
===============================================================================
Package Arch Version Repository Size
===============================================================================
Removing:
ipvsadm x86_64 1.26-4.el6 @base 78 k
piranha x86_64 0.8.6-4.el6_5.2 @base 5.0 M
Transaction Summary
===============================================================================
Remove 2 Package(s)
Installed size: 5.1 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : piranha-0.8.6-4.el6_5.2.x86_64 1/2
Erasing : ipvsadm-1.26-4.el6.x86_64 2/2
Verifying : piranha-0.8.6-4.el6_5.2.x86_64 1/2
Verifying : ipvsadm-1.26-4.el6.x86_64 2/2
Removed:
ipvsadm.x86_64 0:1.26-4.el6 piranha.x86_64 0:0.8.6-4.el6_5.2
Complete!
To update system kernel
To update the all security and binary packages,
[root@linuxhelp ~]# yum update
Yum cache
By default yum keeps the repository enabled package data in /var/cache/yum/ with each sub-directory. To clean all cached files from enabled repository.
Example
[root@linuxhelp ~]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
To view history of yum
Example
[root@linuxhelp ~]#yum history
Loaded plugins: fastestmirror, refresh-packagekit, security
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
6 | root | 2016-02-27 19:58 | Erase | 2
5 | root | 2016-02-27 19:51 | Install | 5
4 | root | 2016-02-27 18:45 | O, U | 10
3 | root | 2016-02-27 18:25 | Install | 1 PP
2 | root | 2016-02-27 18:17 | I, O, U | 137 **
1 | System | 2015-12-24 05:12 | Install | 1089
history list
To update group Package
Example
[root@linuxhelp Desktop]# yum groupupdate ' perl support'
Loaded plugins: auto-update-debuginfo, fastestmirror, protectbase, refresh-packagekit, security
Setting up Group Process
Loading mirror speeds from cached hostfile
* base: mirror.dhakacom.com
* epel: download.ispsystem.com
* epel-debuginfo: kartolo.sby.datautama.net.id
* extras: mirror.dhakacom.com
* ispsystem-base: download.ispsystem.com
* ispsystem-stable5: download.ispsystem.com
* rpmforge: apt.sw.be
.
.
.
Dependency Installed:
perl-Archive-Extract.x86_64 1:0.38-141.el6_7.1 perl-CPAN.x86_64 0:1.9402-141.el6_7.1
perl-CPANPLUS.x86_64 0:0.88-141.el6_7.1 perl-Compress-Raw-Bzip2.x86_64 0:2.052-1.el6.rf
perl-DBD-SQLite.x86_64 0:1.27-3.el6 perl-DBIx-Simple.noarch 0:1.32-3.el6
perl-ExtUtils-CBuilder.x86_64 1:0.27-141.el6_7.1 perl-ExtUtils-Embed.x86_64 0:1.28-141.el6_7.1
perl-File-Fetch.x86_64 0:0.26-141.el6_7.1 perl-IO-Compress-Bzip2.x86_64 0:2.021-
perl-libxml-perl.noarch 0:0.08-10.el6 perl-parent.x86_64 1:0.221-141.el6_7.1
Complete!
For Interactive YUM shell
Yum is also normally a shell which allows to run commands inside that shell.
Example
[root@linuxhelp Desktop]# yum shell
Loaded plugins: auto-update-debuginfo, fastestmirror, protectbase, refresh-packagekit, security
Setting up Yum Shell
> info squid
Loading mirror speeds from cached hostfile
* base: mirror.dhakacom.com
* epel: download.ispsystem.com
* epel-debuginfo: kartolo.sby.datautama.net.id
.
.
.
Installed Packages
Name : squid
Arch : x86_64
Epoch : 7
Version : 3.1.23
Release : 9.el6
Size : 6.3 M
Repo : installed
From repo : base
Summary : The Squid proxy caching server
URL : http://www.squid-cache.org
License : GPLv2 and (LGPLv2+ and Public Domain)
Description : Squid is a high-performance proxy caching server for Web clients,
: supporting FTP, gopher, and HTTP data objects. Unlike traditional
: caching software, Squid handles all requests in a single,
: non-blocking, I/O-driven process. Squid keeps meta data and especially
: hot objects cached in RAM, caches DNS lookups, supports non-blocking
: DNS lookups, and implements negative caching of failed requests.
:
: Squid consists of a main server program squid, a Domain Name System
: lookup program (dnsserver), a program for retrieving FTP data
: (ftpget), and some management and client tools.
Install a Package from Specific Repository
If you want to install some packages from the respective repository then you need to enable it first. For example, if a package is located in epel repo then you need to install epel repo at first and enable it. But enabling the repo could be done in command itself.
Example
[root@linuxhelp Desktop]# yum --enablerepo=epel install phpmyadmin
Loaded plugins: auto-update-debuginfo, fastestmirror, protectbase, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.dhakacom.com
* epel: download.ispsystem.com
* epel-debuginfo: kartolo.sby.datautama.net.id
.
.
Dependency Installed:
coremanager-pkg-php.x86_64 0:5.50.0-9.el6 ispmanager-pkg-httpd-itk-cl.x86_64 0:5.50.0-2.el6
ispmanager-pkg-php.x86_64 0:5.50.0-2.el6 mod_rpaf.x86_64 0:0.8.2-1.el6
mod_ssl.x86_64 2:2.2.15-47.el6.vm mysql-libs.x86_64 0:5.1.73-5.el6_7.1
php.x86_64 0:5.3.3-46.el6_7.1 php-bcmath.x86_64 0:5.3.3-46.el6_7.1
php-cli.x86_64 0:5.3.3-46.el6_7.1 php-common.x86_64 0:5.3.3-46.el6_7.1
php-gd.x86_64 0:5.3.3-46.el6_7.1 php-mbstring.x86_64 0:5.3.3-46.el6_7.1
php-mcrypt.x86_64 0:5.3.3-4.el6 php-mysql.x86_64 0:5.3.3-46.el6_7.1
Complete!
Comments ( 0 )
No comments available