As part of system admin activities, we need to install, remove and update the system packages. Most of the Linux distros have package manager utility.
Here i have listed some linux distros and its package manager.
Redhat/Centos/Oracle linux - yum (Yellow-Dog Updater Modified)
Fedora - yum / DNF (Dandified YUM)
opensuse - zypper
ubuntu/debian - apt / dpkg /synaptic
Arch Linux - pacman
Gentoo Linux - Portage
Yum (Yellow-Dog Updater Modified) is default package manager for some of the Linux distros.
Earlier, rpm command is used for managing packages. Yum command knows how to resolve dependencies by sourcing the additional package. But rpm command can alert us the dependencies, it is unable to source the additional packages.
This documents is having some important yum command with example.
1. To check the version of the yum installed on the server.
[root@nsk ~]# yum --version
3.4.3
2. If we want to know the dependency package before installing the package.
Yum deplist will list all the dependencies and what packages provide those dependencies for the given packages.
[root@nsk ~]# yum deplist tigervnc
package: tigervnc.x86_64 1.8.0-5.el7
dependency: /bin/sh
provider: bash.x86_64 4.2.46-30.el7
dependency: coreutils
provider: coreutils.x86_64 8.22-21.el7
....
..
.
dependency: tigervnc-license
provider: tigervnc-license.noarch 1.8.0-5.el7
3. To install the package. Here -y option will install the vnc package without any prompt. Also all dependency packages also installed.
[root@nsk ~]# yum install vnc -y
Installed:
tigervnc.x86_64 0:1.8.0-5.el7
Dependency Installed:
fltk.x86_64 0:1.3.4-1.el7 mesa-libGLU.x86_64 0:9.0.0-4.el7 tigervnc-icons.noarch 0:1.8.0-5.el7
Complete!
[root@nsk ~]#
4. To uninstall the package. Here dependency packages also removed.
[root@nsk ~]# yum remove vnc
Erasing : tigervnc-1.8.0-5.el7.x86_64 1/1
Verifying : tigervnc-1.8.0-5.el7.x86_64 1/1
Removed:
tigervnc.x86_64 0:1.8.0-5.el7
Complete!
[root@nsk ~]#
5. To know the linux machine had any updates that needed to be applied without running it interactively.
[root@nsk ~]# yum check-update
dconf.x86_64 0.26.0-3.el7_5.1 updates
firefox.x86_64 60.2.1-1.el7.centos updates
firewall-config.noarch 0.4.4.4-15.el7_5 updates
firewalld.noarch 0.4.4.4-15.el7_5 updates
firewalld-filesystem.noarch 0.4.4.4-15.el7_5 updates
flatpak.x86_64 0.8.8-4.el7_5 updates
Exit value codes
100 - Package available for updates or lists the packages
0 - No package available for update
1 - Error
6. We can update the existing installed package.
If we have older version package installed in server and we can use yum update packagename to upgrade it to current version.
[root@nsk ~]# yum update ansible.noarch
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.6.3-1.el7 will be updated
---> Package ansible.noarch 0:2.6.5-1.el7 will be an update
7. If we want to update the specific version of package.
Here we need to specify the exact version of the package. It will work like upgrade.
[root@nsk ~]# yum update-to tigervnc-1.8.0-5.el7.x86_64
8. If you want to downgrade the currently installed package to previous highest version or particular version.
Yum downgrade command is used to downgrade a package from the version currently installed to the previouse highest version or specific version.
Currently installed firefox version
[root@nsk ~]# rpm -qa | grep -i firefox
firefox-60.1.0-4.el7.centos.x86_64
[root@nsk ~]# yum downgrade firefox
Installing : firefox-52.8.0-1.el7.centos.x86_64 1/2
Cleanup : firefox-60.1.0-4.el7.centos.x86_64 2/2
Verifying : firefox-52.8.0-1.el7.centos.x86_64 1/2
Verifying : firefox-60.1.0-4.el7.centos.x86_64 2/2
Removed:
firefox.x86_64 0:60.1.0-4.el7.centos
Installed:
firefox.x86_64 0:52.8.0-1.el7.centos
Complete!
[root@nsk ~]# rpm -qa | grep -i firefox
firefox-52.8.0-1.el7.centos.x86_64
9. Search the package which needs to be installed
Yum search command is used to search by using keyword.
[root@nsk ~]# yum search vnc
tigervnc.x86_64 : A TigerVNC remote display system
tigervnc-icons.noarch : Icons for TigerVNC viewer
tigervnc-license.noarch : License of TigerVNC suite
tigervnc-server.x86_64 : A TigerVNC server
xorg-x11-server-source.noarch : Xserver source code required to build VNC server (Xvnc)
Name and summary matches only, use "search all" for everything.
[root@nsk ~]#
10. Display about the information about package
Once you search the package, Yum info command is used to display some additional information about that package.
[root@nsk ~]# yum info tigervnc.x86_64
Available Packages
Name : tigervnc
Arch : x86_64
Version : 1.8.0
Release : 5.el7
Size : 239 k
Repo : base/7/x86_64
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.
11. View all available packages.
yum list will show all available packages.
[root@nsk ~]# yum list
12. View only the installed packages
[root@nsk ~]# yum list installed
13. Find a package name by using file name.
Yum provides command is used to findout the package which is related to the file in Linux server.
[root@nsk ~]# yum provides /etc/nsswitch.conf
glibc-2.17-222.el7.i686 : The GNU libc libraries
Repo : base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.x86_64 : The GNU libc libraries
Repo : base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.i686 : The GNU libc libraries
Repo : @base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.x86_64 : The GNU libc libraries
Repo : @base
Matched from:
Filename : /etc/nsswitch.conf
14. Find a list of group software packages
In yum, related packages are grouped together with specific name. We can install the group instead of search one by one.
[root@nsk ~]# yum grouplist
Installed Environment Groups:
GNOME Desktop
Available Environment Groups:
Minimal Install
Compute Node
Infrastructure Server
File and Print Server
Cinnamon Desktop
MATE Desktop
Basic Web Server
Virtualization Host
Server with GUI
KDE Plasma Workspaces
Development and Creative Workstation
Available Groups:
Cinnamon
Compatibility Libraries
Console Internet Tools
Development Tools
Educational Software
Electronic Lab
Fedora Packager
General Purpose Desktop
Graphical Administration Tools
Haskell
Legacy UNIX Compatibility
MATE
Milkymist
Scientific Support
Security Tools
Smart Card Support
System Administration Tools
System Management
TurboGears application framework
Xfce
Done
[root@nsk ~]#
15. If we want to install particular rpm group, can yum groupinstall
[root@nsk ~]# yum groupinstall 'MATE'
16. Display the available software repositories
Yum is always pointed to some of the software repositories. We can view the same by running below command.
[root@nsk ~]# yum repolist
17. Install from disabled repositories.
Normally all the repositories are enabled. If we need to install packages from disabled repositories, we need to use below command.
[root@nsk ~]# yum --enablerepo=epel install tigervnc.x86_64
Running transaction
Installing : tigervnc-1.8.0-5.el7.x86_64 1/1
Verifying : tigervnc-1.8.0-5.el7.x86_64 1/1
Installed:
tigervnc.x86_64 0:1.8.0-5.el7
Complete!
18. Yum commands in interactive shell.
we can run yum commands in interactive shell mode.
[root@nsk ~]# yum shell
> updateinfo
epel/x86_64/updateinfo | 948 kB 00:00:00
Updates Information Summary: updates
3 Bugfix notice(s)
2 Enhancement notice(s)
By using shell command, we can run multiple commands from a file. First add the command in text file then execute the yum shell command.
[root@nsk nsk]# cat shell_cmd.txt
provides /etc/nsswitch.conf
info tigervnc.x86_64
[root@nsk nsk]# yum shell shell_cmd.txt
glibc-2.17-222.el7.i686 : The GNU libc libraries
Repo : base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.x86_64 : The GNU libc libraries
Repo : base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.i686 : The GNU libc libraries
Repo : @base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.x86_64 : The GNU libc libraries
Repo : @base
Matched from:
Filename : /etc/nsswitch.conf
Installed Packages
Name : tigervnc
Arch : x86_64
Version : 1.8.0
Release : 5.el7
Size : 680 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.
19. If we want to see the status of past yum activities
Yum history command is used to view the past activities of yum. We can use info/list/packages-list/packages-info/summary to view what happened, undo/redo/rollback to act on that information and new to start a new history file.
Here,
info/list/summary - use transaction id or package
packages-list/packages-info - use package
undo/redo/rollback - use single transaction id or the keyword and an offset from the last transaction
undo/redo - use specified transaction id
[root@nsk ~]# yum history list
Loaded plugins: fastestmirror, langpacks
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
50 | update firefox | 2018-10-10 15:31 | Update | 1
49 | downgrade firefox | 2018-10-10 15:20 | Downgrade | 1
48 | remove tigervnc-1.8.0-5. | 2018-10-09 18:19 | Erase | 1
47 | --enablerepo=epel instal | 2018-10-09 17:29 | Install | 1
46 | remove vnc | 2018-10-09 15:12 | Erase | 1
45 | install vnc | 2018-10-09 15:10 | Install | 4
44 | install nmon | 2018-10-08 15:33 | Install | 1
43 | install pwgen | 2018-09-18 16:04 | Install | 1
42 | install php-* --skip-bro | 2018-09-13 20:06 | Install | 638 ss
41 | install mysql-* | 2018-09-13 19:52 | Install | 87
40 | install ipython | 2018-09-13 18:41 | Install | 35
39 | install phpmy* | 2018-09-07 18:35 | Install | 2
38 | install mariadb-* | 2018-09-07 13:20 | Install | 9
37 | erase mariadb-* | 2018-09-07 13:20 | Erase | 9
36 | install mariadb-* | 2018-09-07 13:19 | Install | 9
35 | remove mariadb-* | 2018-09-07 13:18 | Erase | 9
34 | install mariadb-* | 2018-09-07 12:10 | Install | 19
33 | remove mariadb-* | 2018-09-07 11:55 | Erase | 8 EE
32 | install phpmyadmin | 2018-08-31 14:00 | Install | 7 <
31 | install php-pgsql | 2018-08-31 13:22 | Install | 2 >
history list
Here,
> - The rpmdb was changed, outside yum, after the transaction.
< - The rpmdb was changed, outside yum, before the transaction.
* - The transaction aborted before completion.
# - The transaction completed, but with a non-zero status.
E - The transaction completed fine, but had warning/error output during the transaction.
P - The transaction completed fine, but problems already existed in the rpmdb.
s - The transaction completed fine, but --skip-broken was enabled and had to skip some packages.
[root@nsk ~]# yum history list all
Loaded plugins: product-id, rhnplugin, search-disabled-repos, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
38 | Shahapuri ... <a251761> | 2018-08-03 17:45 | I, O, U | 145 EE
37 | Shahapuri ... <a251761> | 2018-08-03 17:43 | Update | 5
36 | System <unset> | 2018-05-11 11:27 | Erase | 2 EE
35 | T ... <a262237> | 2018-03-01 10:46 | E, I, U | 80 EE
34 | System <unset> | 2017-12-01 13:47 | Update | 1 EE
33 | Kukkala ... <a253740> | 2017-11-24 10:42 | E, I, U | 246 EE
32 | Kukkala ... <a253740> | 2017-11-24 10:38 | Update | 3
31 | System <unset> | 2017-11-21 14:50 | I, U | 4
30 | System <unset> | 2017-06-16 09:57 | Update | 2
29 | Govindu ... <a055637> | 2017-02-20 13:17 | E, I, U | 42 EE
28 | Shukla ... <a222788> | 2016-11-04 10:01 | E, I, U | 31 EE
27 | Shukla ... <a222788> | 2016-11-04 10:00 | Update | 1
26 | S ... <a210111> | 2016-08-18 15:34 | E, I, O, U | 261 EE
25 | S ... <a210111> | 2016-08-18 15:24 | Update | 3 EE
24 | System <unset> | 2016-08-05 14:42 | Install | 4
23 | Bennurmth ... <a215476> | 2016-06-30 14:17 | Update | 1
22 | S ... <a034124> | 2016-06-01 09:16 | E, I, U | 5
21 | Govindu ... <a055637> | 2016-02-24 12:42 | E, I, U | 267 EE
20 | Govindu ... <a055637> | 2016-02-24 12:40 | Update | 3
19 | Honappa ... <a175300> | 2016-02-04 11:52 | Install | 1
18 | Honappa ... <a175300> | 2016-02-04 11:52 | I, U | 29
17 | Lindström ... <a209141> | 2015-12-02 08:15 | Install | 4 <
16 | Lindström ... <a209141> | 2015-11-06 10:07 | I, U | 6 >
15 | Lindström ... <a209141> | 2015-11-06 10:07 | Install | 6
14 | Lindström ... <a209141> | 2015-11-06 10:06 | Update | 1
13 | Lindström ... <a209141> | 2015-11-06 10:06 | Update | 5
12 | Meijer ... <a044156> | 2015-03-25 18:03 | Install | 16
11 | Meijer ... <a044156> | 2015-03-25 15:54 | Install | 5
10 | Palakurthi ... <tin1926> | 2015-01-28 19:08 | I, U | 262 EE
9 | Muniraj ... <a028981> | 2014-12-24 14:44 | Update | 2
8 | System <unset> | 2014-09-26 10:04 | Update | 1
7 | System <unset> | 2014-09-25 16:10 | Update | 1
6 | System <unset> | 2014-09-15 11:45 | Install | 1 EE
5 | System <unset> | 2014-09-15 11:44 | Erase | 1
4 | System <unset> | 2014-09-15 11:41 | Install | 15
3 | System <unset> | 2014-09-15 11:37 | I, U | 94 EE
2 | System <unset> | 2014-09-15 11:36 | Install | 35
1 | System <unset> | 2014-09-15 11:29 | Install | 573
history list
20. If we want to know the last transactions details from history list. We can specifically give the transaction ID to know about it.
[root@nsk ~]# yum history info
Loaded plugins: fastestmirror, langpacks
Transaction ID : 50
Begin time : Wed Oct 10 15:31:55 2018
Begin rpmdb : 2356:97f14b883648310fc9cf9ed660ba4f5f7b52c615
End time : 15:32:09 2018 (14 seconds)
End rpmdb : 2356:efedc71553518d49ee1e9feb83d17272b3fde07a
User : root <root>
Return-Code : Success
Command Line : update firefox
Transaction performed with:
Installed rpm-4.11.3-32.el7.x86_64 @base
Installed yum-3.4.3-158.el7.centos.noarch @base
Installed yum-metadata-parser-1.1.4-10.el7.x86_64 @anaconda
Installed yum-plugin-fastestmirror-1.1.31-46.el7_5.noarch @updates
Packages Altered:
Updated firefox-52.8.0-1.el7.centos.x86_64 @updates
Update 60.2.1-1.el7.centos.x86_64 @updates
history info
[root@nsk ~]# yum history info 43
Loaded plugins: fastestmirror, langpacks
Transaction ID : 43
Begin time : Tue Sep 18 16:04:53 2018
Begin rpmdb : 2351:7203da1b9738104d8a8aa568e21412033e0bd122
End time : (0 seconds)
End rpmdb : 2352:020dc0b21e7c31b8452fea1a659a87d426f0370a
User : root <root>
Return-Code : Success
Command Line : install pwgen
Transaction performed with:
Installed rpm-4.11.3-32.el7.x86_64 @base
Installed yum-3.4.3-158.el7.centos.noarch @base
Installed yum-metadata-parser-1.1.4-10.el7.x86_64 @anaconda
Installed yum-plugin-fastestmirror-1.1.31-46.el7_5.noarch @updates
Packages Altered:
Install pwgen-2.08-1.el7.x86_64 @epel
history info
21. Package-info is used to know when the package is installed. If it is transacted more than one time also listed.
[root@nsk ~]# yum history package-info php
Loaded plugins: fastestmirror, langpacks
Transaction ID : 24
Begin time : Thu Aug 30 13:59:58 2018
Package : php-5.4.16-45.el7.x86_64
State : Install
Size : 4,591,806
Build host : x86-01.bsys.centos.org
Build time : Fri Apr 13 00:42:53 2018
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
License : PHP and Zend and BSD
URL : http://www.php.net/
Source RPM : php-5.4.16-45.el7.src.rpm
Commit Time : Tue Jan 23 17:30:00 2018
Committer : Remi Collet <rcollet@redhat.com>
Reason : user
Command Line : install php
From repo : base
Installed by : root <root>
history package-info
[root@nsk ~]#
22. Package-list will show the transaction id and respective action.
[root@nsk ~]# yum history package-list firefox
Loaded plugins: fastestmirror, langpacks
ID | Action(s) | Package
-------------------------------------------------------------------------------
50 | Updated | firefox-52.8.0-1.el7.centos.x86_64
50 | Update | 60.2.1-1.el7.centos.x86_64
49 | Downgrade | firefox-52.8.0-1.el7.centos.x86_64
49 | Downgraded | 60.1.0-4.el7.centos.x86_64
29 | Install | firefox-60.1.0-4.el7.centos.x86_64 EE
history package-list
23. Download a package without installation
Don't update, just download it. This action will be done in background, so yum lock is release for other action. We can mention the download directory
[root@nsk ~]# yum install --downloadonly --downloaddir=/download/dir package
24. Skip Packages With Broken Dependencies during update.
It will resolve depsolve problems by removing packages that are causing problems from the transaction.
[root@nsk ~]# yum update --skip-broken
25. Exclude kernel or other packages from getting updated
[root@nsk ~]# yum update --exclude=PACKAGENAME
Here i have listed some linux distros and its package manager.
Redhat/Centos/Oracle linux - yum (Yellow-Dog Updater Modified)
Fedora - yum / DNF (Dandified YUM)
opensuse - zypper
ubuntu/debian - apt / dpkg /synaptic
Arch Linux - pacman
Gentoo Linux - Portage
Yum (Yellow-Dog Updater Modified) is default package manager for some of the Linux distros.
Earlier, rpm command is used for managing packages. Yum command knows how to resolve dependencies by sourcing the additional package. But rpm command can alert us the dependencies, it is unable to source the additional packages.
This documents is having some important yum command with example.
1. To check the version of the yum installed on the server.
[root@nsk ~]# yum --version
3.4.3
2. If we want to know the dependency package before installing the package.
Yum deplist will list all the dependencies and what packages provide those dependencies for the given packages.
[root@nsk ~]# yum deplist tigervnc
package: tigervnc.x86_64 1.8.0-5.el7
dependency: /bin/sh
provider: bash.x86_64 4.2.46-30.el7
dependency: coreutils
provider: coreutils.x86_64 8.22-21.el7
....
..
.
dependency: tigervnc-license
provider: tigervnc-license.noarch 1.8.0-5.el7
3. To install the package. Here -y option will install the vnc package without any prompt. Also all dependency packages also installed.
[root@nsk ~]# yum install vnc -y
Installed:
tigervnc.x86_64 0:1.8.0-5.el7
Dependency Installed:
fltk.x86_64 0:1.3.4-1.el7 mesa-libGLU.x86_64 0:9.0.0-4.el7 tigervnc-icons.noarch 0:1.8.0-5.el7
Complete!
[root@nsk ~]#
4. To uninstall the package. Here dependency packages also removed.
[root@nsk ~]# yum remove vnc
Erasing : tigervnc-1.8.0-5.el7.x86_64 1/1
Verifying : tigervnc-1.8.0-5.el7.x86_64 1/1
Removed:
tigervnc.x86_64 0:1.8.0-5.el7
Complete!
[root@nsk ~]#
5. To know the linux machine had any updates that needed to be applied without running it interactively.
[root@nsk ~]# yum check-update
dconf.x86_64 0.26.0-3.el7_5.1 updates
firefox.x86_64 60.2.1-1.el7.centos updates
firewall-config.noarch 0.4.4.4-15.el7_5 updates
firewalld.noarch 0.4.4.4-15.el7_5 updates
firewalld-filesystem.noarch 0.4.4.4-15.el7_5 updates
flatpak.x86_64 0.8.8-4.el7_5 updates
Exit value codes
100 - Package available for updates or lists the packages
0 - No package available for update
1 - Error
6. We can update the existing installed package.
If we have older version package installed in server and we can use yum update packagename to upgrade it to current version.
[root@nsk ~]# yum update ansible.noarch
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.6.3-1.el7 will be updated
---> Package ansible.noarch 0:2.6.5-1.el7 will be an update
7. If we want to update the specific version of package.
Here we need to specify the exact version of the package. It will work like upgrade.
[root@nsk ~]# yum update-to tigervnc-1.8.0-5.el7.x86_64
8. If you want to downgrade the currently installed package to previous highest version or particular version.
Yum downgrade command is used to downgrade a package from the version currently installed to the previouse highest version or specific version.
Currently installed firefox version
[root@nsk ~]# rpm -qa | grep -i firefox
firefox-60.1.0-4.el7.centos.x86_64
[root@nsk ~]# yum downgrade firefox
Installing : firefox-52.8.0-1.el7.centos.x86_64 1/2
Cleanup : firefox-60.1.0-4.el7.centos.x86_64 2/2
Verifying : firefox-52.8.0-1.el7.centos.x86_64 1/2
Verifying : firefox-60.1.0-4.el7.centos.x86_64 2/2
Removed:
firefox.x86_64 0:60.1.0-4.el7.centos
Installed:
firefox.x86_64 0:52.8.0-1.el7.centos
Complete!
[root@nsk ~]# rpm -qa | grep -i firefox
firefox-52.8.0-1.el7.centos.x86_64
9. Search the package which needs to be installed
Yum search command is used to search by using keyword.
[root@nsk ~]# yum search vnc
tigervnc.x86_64 : A TigerVNC remote display system
tigervnc-icons.noarch : Icons for TigerVNC viewer
tigervnc-license.noarch : License of TigerVNC suite
tigervnc-server.x86_64 : A TigerVNC server
xorg-x11-server-source.noarch : Xserver source code required to build VNC server (Xvnc)
Name and summary matches only, use "search all" for everything.
[root@nsk ~]#
10. Display about the information about package
Once you search the package, Yum info command is used to display some additional information about that package.
[root@nsk ~]# yum info tigervnc.x86_64
Available Packages
Name : tigervnc
Arch : x86_64
Version : 1.8.0
Release : 5.el7
Size : 239 k
Repo : base/7/x86_64
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.
11. View all available packages.
yum list will show all available packages.
[root@nsk ~]# yum list
12. View only the installed packages
[root@nsk ~]# yum list installed
13. Find a package name by using file name.
Yum provides command is used to findout the package which is related to the file in Linux server.
[root@nsk ~]# yum provides /etc/nsswitch.conf
glibc-2.17-222.el7.i686 : The GNU libc libraries
Repo : base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.x86_64 : The GNU libc libraries
Repo : base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.i686 : The GNU libc libraries
Repo : @base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.x86_64 : The GNU libc libraries
Repo : @base
Matched from:
Filename : /etc/nsswitch.conf
14. Find a list of group software packages
In yum, related packages are grouped together with specific name. We can install the group instead of search one by one.
[root@nsk ~]# yum grouplist
Installed Environment Groups:
GNOME Desktop
Available Environment Groups:
Minimal Install
Compute Node
Infrastructure Server
File and Print Server
Cinnamon Desktop
MATE Desktop
Basic Web Server
Virtualization Host
Server with GUI
KDE Plasma Workspaces
Development and Creative Workstation
Available Groups:
Cinnamon
Compatibility Libraries
Console Internet Tools
Development Tools
Educational Software
Electronic Lab
Fedora Packager
General Purpose Desktop
Graphical Administration Tools
Haskell
Legacy UNIX Compatibility
MATE
Milkymist
Scientific Support
Security Tools
Smart Card Support
System Administration Tools
System Management
TurboGears application framework
Xfce
Done
[root@nsk ~]#
15. If we want to install particular rpm group, can yum groupinstall
[root@nsk ~]# yum groupinstall 'MATE'
16. Display the available software repositories
Yum is always pointed to some of the software repositories. We can view the same by running below command.
[root@nsk ~]# yum repolist
17. Install from disabled repositories.
Normally all the repositories are enabled. If we need to install packages from disabled repositories, we need to use below command.
[root@nsk ~]# yum --enablerepo=epel install tigervnc.x86_64
Running transaction
Installing : tigervnc-1.8.0-5.el7.x86_64 1/1
Verifying : tigervnc-1.8.0-5.el7.x86_64 1/1
Installed:
tigervnc.x86_64 0:1.8.0-5.el7
Complete!
18. Yum commands in interactive shell.
we can run yum commands in interactive shell mode.
[root@nsk ~]# yum shell
> updateinfo
epel/x86_64/updateinfo | 948 kB 00:00:00
Updates Information Summary: updates
3 Bugfix notice(s)
2 Enhancement notice(s)
By using shell command, we can run multiple commands from a file. First add the command in text file then execute the yum shell command.
[root@nsk nsk]# cat shell_cmd.txt
provides /etc/nsswitch.conf
info tigervnc.x86_64
[root@nsk nsk]# yum shell shell_cmd.txt
glibc-2.17-222.el7.i686 : The GNU libc libraries
Repo : base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.x86_64 : The GNU libc libraries
Repo : base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.i686 : The GNU libc libraries
Repo : @base
Matched from:
Filename : /etc/nsswitch.conf
glibc-2.17-222.el7.x86_64 : The GNU libc libraries
Repo : @base
Matched from:
Filename : /etc/nsswitch.conf
Installed Packages
Name : tigervnc
Arch : x86_64
Version : 1.8.0
Release : 5.el7
Size : 680 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.
19. If we want to see the status of past yum activities
Yum history command is used to view the past activities of yum. We can use info/list/packages-list/packages-info/summary to view what happened, undo/redo/rollback to act on that information and new to start a new history file.
Here,
info/list/summary - use transaction id or package
packages-list/packages-info - use package
undo/redo/rollback - use single transaction id or the keyword and an offset from the last transaction
undo/redo - use specified transaction id
[root@nsk ~]# yum history list
Loaded plugins: fastestmirror, langpacks
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
50 | update firefox | 2018-10-10 15:31 | Update | 1
49 | downgrade firefox | 2018-10-10 15:20 | Downgrade | 1
48 | remove tigervnc-1.8.0-5. | 2018-10-09 18:19 | Erase | 1
47 | --enablerepo=epel instal | 2018-10-09 17:29 | Install | 1
46 | remove vnc | 2018-10-09 15:12 | Erase | 1
45 | install vnc | 2018-10-09 15:10 | Install | 4
44 | install nmon | 2018-10-08 15:33 | Install | 1
43 | install pwgen | 2018-09-18 16:04 | Install | 1
42 | install php-* --skip-bro | 2018-09-13 20:06 | Install | 638 ss
41 | install mysql-* | 2018-09-13 19:52 | Install | 87
40 | install ipython | 2018-09-13 18:41 | Install | 35
39 | install phpmy* | 2018-09-07 18:35 | Install | 2
38 | install mariadb-* | 2018-09-07 13:20 | Install | 9
37 | erase mariadb-* | 2018-09-07 13:20 | Erase | 9
36 | install mariadb-* | 2018-09-07 13:19 | Install | 9
35 | remove mariadb-* | 2018-09-07 13:18 | Erase | 9
34 | install mariadb-* | 2018-09-07 12:10 | Install | 19
33 | remove mariadb-* | 2018-09-07 11:55 | Erase | 8 EE
32 | install phpmyadmin | 2018-08-31 14:00 | Install | 7 <
31 | install php-pgsql | 2018-08-31 13:22 | Install | 2 >
history list
Here,
> - The rpmdb was changed, outside yum, after the transaction.
< - The rpmdb was changed, outside yum, before the transaction.
* - The transaction aborted before completion.
# - The transaction completed, but with a non-zero status.
E - The transaction completed fine, but had warning/error output during the transaction.
P - The transaction completed fine, but problems already existed in the rpmdb.
s - The transaction completed fine, but --skip-broken was enabled and had to skip some packages.
[root@nsk ~]# yum history list all
Loaded plugins: product-id, rhnplugin, search-disabled-repos, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
38 | Shahapuri ... <a251761> | 2018-08-03 17:45 | I, O, U | 145 EE
37 | Shahapuri ... <a251761> | 2018-08-03 17:43 | Update | 5
36 | System <unset> | 2018-05-11 11:27 | Erase | 2 EE
35 | T ... <a262237> | 2018-03-01 10:46 | E, I, U | 80 EE
34 | System <unset> | 2017-12-01 13:47 | Update | 1 EE
33 | Kukkala ... <a253740> | 2017-11-24 10:42 | E, I, U | 246 EE
32 | Kukkala ... <a253740> | 2017-11-24 10:38 | Update | 3
31 | System <unset> | 2017-11-21 14:50 | I, U | 4
30 | System <unset> | 2017-06-16 09:57 | Update | 2
29 | Govindu ... <a055637> | 2017-02-20 13:17 | E, I, U | 42 EE
28 | Shukla ... <a222788> | 2016-11-04 10:01 | E, I, U | 31 EE
27 | Shukla ... <a222788> | 2016-11-04 10:00 | Update | 1
26 | S ... <a210111> | 2016-08-18 15:34 | E, I, O, U | 261 EE
25 | S ... <a210111> | 2016-08-18 15:24 | Update | 3 EE
24 | System <unset> | 2016-08-05 14:42 | Install | 4
23 | Bennurmth ... <a215476> | 2016-06-30 14:17 | Update | 1
22 | S ... <a034124> | 2016-06-01 09:16 | E, I, U | 5
21 | Govindu ... <a055637> | 2016-02-24 12:42 | E, I, U | 267 EE
20 | Govindu ... <a055637> | 2016-02-24 12:40 | Update | 3
19 | Honappa ... <a175300> | 2016-02-04 11:52 | Install | 1
18 | Honappa ... <a175300> | 2016-02-04 11:52 | I, U | 29
17 | Lindström ... <a209141> | 2015-12-02 08:15 | Install | 4 <
16 | Lindström ... <a209141> | 2015-11-06 10:07 | I, U | 6 >
15 | Lindström ... <a209141> | 2015-11-06 10:07 | Install | 6
14 | Lindström ... <a209141> | 2015-11-06 10:06 | Update | 1
13 | Lindström ... <a209141> | 2015-11-06 10:06 | Update | 5
12 | Meijer ... <a044156> | 2015-03-25 18:03 | Install | 16
11 | Meijer ... <a044156> | 2015-03-25 15:54 | Install | 5
10 | Palakurthi ... <tin1926> | 2015-01-28 19:08 | I, U | 262 EE
9 | Muniraj ... <a028981> | 2014-12-24 14:44 | Update | 2
8 | System <unset> | 2014-09-26 10:04 | Update | 1
7 | System <unset> | 2014-09-25 16:10 | Update | 1
6 | System <unset> | 2014-09-15 11:45 | Install | 1 EE
5 | System <unset> | 2014-09-15 11:44 | Erase | 1
4 | System <unset> | 2014-09-15 11:41 | Install | 15
3 | System <unset> | 2014-09-15 11:37 | I, U | 94 EE
2 | System <unset> | 2014-09-15 11:36 | Install | 35
1 | System <unset> | 2014-09-15 11:29 | Install | 573
history list
20. If we want to know the last transactions details from history list. We can specifically give the transaction ID to know about it.
[root@nsk ~]# yum history info
Loaded plugins: fastestmirror, langpacks
Transaction ID : 50
Begin time : Wed Oct 10 15:31:55 2018
Begin rpmdb : 2356:97f14b883648310fc9cf9ed660ba4f5f7b52c615
End time : 15:32:09 2018 (14 seconds)
End rpmdb : 2356:efedc71553518d49ee1e9feb83d17272b3fde07a
User : root <root>
Return-Code : Success
Command Line : update firefox
Transaction performed with:
Installed rpm-4.11.3-32.el7.x86_64 @base
Installed yum-3.4.3-158.el7.centos.noarch @base
Installed yum-metadata-parser-1.1.4-10.el7.x86_64 @anaconda
Installed yum-plugin-fastestmirror-1.1.31-46.el7_5.noarch @updates
Packages Altered:
Updated firefox-52.8.0-1.el7.centos.x86_64 @updates
Update 60.2.1-1.el7.centos.x86_64 @updates
history info
[root@nsk ~]# yum history info 43
Loaded plugins: fastestmirror, langpacks
Transaction ID : 43
Begin time : Tue Sep 18 16:04:53 2018
Begin rpmdb : 2351:7203da1b9738104d8a8aa568e21412033e0bd122
End time : (0 seconds)
End rpmdb : 2352:020dc0b21e7c31b8452fea1a659a87d426f0370a
User : root <root>
Return-Code : Success
Command Line : install pwgen
Transaction performed with:
Installed rpm-4.11.3-32.el7.x86_64 @base
Installed yum-3.4.3-158.el7.centos.noarch @base
Installed yum-metadata-parser-1.1.4-10.el7.x86_64 @anaconda
Installed yum-plugin-fastestmirror-1.1.31-46.el7_5.noarch @updates
Packages Altered:
Install pwgen-2.08-1.el7.x86_64 @epel
history info
21. Package-info is used to know when the package is installed. If it is transacted more than one time also listed.
[root@nsk ~]# yum history package-info php
Loaded plugins: fastestmirror, langpacks
Transaction ID : 24
Begin time : Thu Aug 30 13:59:58 2018
Package : php-5.4.16-45.el7.x86_64
State : Install
Size : 4,591,806
Build host : x86-01.bsys.centos.org
Build time : Fri Apr 13 00:42:53 2018
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
License : PHP and Zend and BSD
URL : http://www.php.net/
Source RPM : php-5.4.16-45.el7.src.rpm
Commit Time : Tue Jan 23 17:30:00 2018
Committer : Remi Collet <rcollet@redhat.com>
Reason : user
Command Line : install php
From repo : base
Installed by : root <root>
history package-info
[root@nsk ~]#
22. Package-list will show the transaction id and respective action.
[root@nsk ~]# yum history package-list firefox
Loaded plugins: fastestmirror, langpacks
ID | Action(s) | Package
-------------------------------------------------------------------------------
50 | Updated | firefox-52.8.0-1.el7.centos.x86_64
50 | Update | 60.2.1-1.el7.centos.x86_64
49 | Downgrade | firefox-52.8.0-1.el7.centos.x86_64
49 | Downgraded | 60.1.0-4.el7.centos.x86_64
29 | Install | firefox-60.1.0-4.el7.centos.x86_64 EE
history package-list
23. Download a package without installation
Don't update, just download it. This action will be done in background, so yum lock is release for other action. We can mention the download directory
[root@nsk ~]# yum install --downloadonly --downloaddir=/download/dir package
24. Skip Packages With Broken Dependencies during update.
It will resolve depsolve problems by removing packages that are causing problems from the transaction.
[root@nsk ~]# yum update --skip-broken
25. Exclude kernel or other packages from getting updated
[root@nsk ~]# yum update --exclude=PACKAGENAME