Saturday, January 20, 2018

YUM (Yellowdog Updater, Modified) Commands for Package Management - Part(2)

11. 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


12. 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
Installed Groups:
Administration Tools
DNS Name Server
Dialup Networking Support
Editors
Engineering and Scientific
FTP Server
Graphics
Java Development
Legacy Network Server
Available Groups:
Authoring and Publishing
Base
Beagle
Cluster Storage
Clustering
Development Libraries
Development Tools
Eclipse
Educational Software
KDE (K Desktop Environment)
KDE Software Development


13. 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'
Dependencies Resolved
=================================================================================================
Package                                                      Arch      Version                Repository        Size
=================================================================================================
Updating:
unixODBC                           i386      2.2.11-10.el5      base              290 k
Installing for dependencies:
unixODBC-libs                      i386      2.2.11-10.el5      base              551 k
Transaction Summary
=================================================================================================
Install       1 Package(s)
Upgrade       1 Package(s)
Total size: 841 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : unixODBC-libs 1/3
Updating       : unixODBC         2/3
Cleanup        : unixODBC         3/3
Dependency Installed:
unixODBC-libs.i386 0:2.2.11-10.el5
Updated:
unixODBC.i386 0:2.2.11-10.el5
Complete!


14. Update a Group Packages

To update any existing installed group packages, just run the following command as shown below.
# yum groupupdate 'DNS Name Server'
Dependencies Resolved
================================================================================================================
Package                Arch            Version                       Repository           Size
================================================================================================================
Updating:
bind                           i386            30:9.3.6-20.P1.el5_8.2          updates              981 k
bind-chroot                    i386            30:9.3.6-20.P1.el5_8.2          updates              47 k
Updating for dependencies:
bind-libs                      i386            30:9.3.6-20.P1.el5_8.2          updates              864 k
bind-utils                     i386            30:9.3.6-20.P1.el5_8.2          updates              174 k
Transaction Summary
================================================================================================================
Install       0 Package(s)
Upgrade       4 Package(s)
Total size: 2.0 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating       : bind-libs            1/8
Updating       : bind                 2/8
Updating       : bind-chroot          3/8
Updating       : bind-utils           4/8
Cleanup        : bind                 5/8
Cleanup        : bind-chroot          6/8
Cleanup        : bind-utils           7/8
Cleanup        : bind-libs            8/8
Updated:
bind.i386 30:9.3.6-20.P1.el5_8.2                  bind-chroot.i386 30:9.3.6-20.P1.el5_8.2
Dependency Updated:
bind-libs.i386 30:9.3.6-20.P1.el5_8.2             bind-utils.i386 30:9.3.6-20.P1.el5_8.2
Complete!


15. Remove a Group Packages

To delete or remove any existing installed group from the system, just use below command.
# yum groupremove 'DNS Name Server'
Dependencies Resolved
===========================================================================================================
Package                Arch              Version                         Repository          Size
===========================================================================================================
Removing:
bind                   i386              30:9.3.6-20.P1.el5_8.2          installed           2.1 M
bind-chroot            i386              30:9.3.6-20.P1.el5_8.2          installed           0.0
Transaction Summary
===========================================================================================================
Remove        2 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
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing        : bind                                                   1/2
warning: /etc/sysconfig/named saved as /etc/sysconfig/named.rpmsave
Erasing        : bind-chroot                                            2/2
Removed:
bind.i386 30:9.3.6-20.P1.el5_8.2                                        bind-chroot.i386 30:9.3.6-20.P1.el5_8.2
Complete!


16. List Enabled Yum Repositories

To list all enabled Yum repositories in your system, use following option.
# yum repolist
repo id                     repo name                                            status
base                        CentOS-5 - Base                                      enabled:  2,725
epel                        Extra Packages for Enterprise Linux 5 - i386         enabled:  5,783
extras                      CentOS-5 - Extras                                    enabled:    282
mod-pagespeed               mod-pagespeed                                        enabled:      1
rpmforge                    RHEL 5 - RPMforge.net - dag                          enabled: 11,290
updates                     CentOS-5 - Updates                                   enabled:    743
repolist: 20,824


16. List all Enabled and Disabled Yum Repositories

The following command will display all enabled and disabled yum repositories on the system.
# yum repolist all
repo id                     repo name                                            status
C5.0-base                   CentOS-5.0 - Base                                    disabled
C5.0-centosplus             CentOS-5.0 - Plus                                    disabled
C5.0-extras                 CentOS-5.0 - Extras                                  disabled
base                        CentOS-5 - Base                                      enabled:  2,725
epel                        Extra Packages for Enterprise Linux 5 - i386         enabled:  5,783
extras                      CentOS-5 - Extras                                    enabled:    282
repolist: 20,824


17. 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
Dependencies Resolved
=============================================================================================
Package                Arch           Version            Repository           Size
=============================================================================================
Installing:
phpMyAdmin             noarch         3.5.1-1.el6        epel                 4.2 M
Transaction Summary
=============================================================================================
Install       1 Package(s)
Total download size: 4.2 M
Installed size: 17 M
Is this ok [y/N]: y
Downloading Packages:
phpMyAdmin-3.5.1-1.el6.noarch.rpm                       | 4.2 MB     00:25
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : phpMyAdmin-3.5.1-1.el6.noarch             1/1
Verifying  : phpMyAdmin-3.5.1-1.el6.noarch             1/1
Installed:
phpMyAdmin.noarch 0:3.5.1-1.el6
Complete!


18. Interactive Yum Shell

Yum utility provides a custom shell where you can execute multiple commands.
# yum shell
Loaded plugins: fastestmirror
Setting up Yum Shell
> update httpd
Loading mirror speeds from cached hostfile
* base: mirrors.sin3.sg.voxel.net
* epel: ftp.riken.jp
* extras: mirrors.sin3.sg.voxel.net
* updates: mirrors.sin3.sg.voxel.net
Setting up Update Process
> 


19. 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


20. View History of Yum

To view all the past transactions of yum command, just use the following command.
# yum history
Loaded plugins: fastestmirror
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
10 | root               | 2012-08-11 15:19 | Install        |    3
9 | root               | 2012-08-11 15:11 | Install        |    1
8 | root               | 2012-08-11 15:10 | Erase          |    1 EE
7 | root               | 2012-08-10 17:44 | Install        |    1
6 | root               | 2012-08-10 12:19 | Install        |    2
5 | root               | 2012-08-10 12:14 | Install        |    3
4 | root               | 2012-08-10 12:12 | I, U           |   13 E<
3 | root               | 2012-08-09 13:01 | Install        |    1 >
2 | root               | 2012-08-08 20:13 | I, U           |  292 EE
1 | System            | 2012-08-08 17:15 | Install        |  560
history list


I have tried to cover all the basic to advance yum commands with their examples. 

No comments:

Post a Comment

Configure NFS Client

This example is based on the environment below. +----------------------+           |           +----------------------+ | [...