Email This List Email This List Print This List Print This List

Update /​ Install Pack­ages Under Red­hat

How do I use yum com­mand to update and patch my Red hat Enter­prise Linux /​ Cen­tOS Linux ver­sion 5.x serv­er via RHN /​ Inter­net? Can I use up2date com­mand under RHEL 5?

up2date com­mand was part of RHEL v4.x or older ver­sion. You need to use yum com­mand to update and patch the sys­tem using RHN or Inter­net. Use yum com­mand to install crit­ic­al and non-crit­ic­al secur­ity updates as well as bin­ary pack­ages. Login as the root user to install and update the sys­tem.

Task: Register my sys­tem with RHN

To register your sys­tem with RHN type the fol­low­ing com­mand and just fol­low on screen instruc­tions (Cen­tOS user skip to next step):
# rhn_register

WARNING! These examples only works with RHEL /​ Cen­tOS Linux ver­sion 5.x or above. For RHEL 4.x and older ver­sion use up2date com­mand.

Task: Dis­play list of updated soft­ware (secur­ity fix)

Type the fol­low­ing com­mand at shell prompt:
# yum list updates

Task: Patch up sys­tem by apply­ing all updates

To down­load and install all updates type the fol­low­ing com­mand:
# yum update

Task: List all installed pack­ages

List all installed pack­ages, enter:
# rpm -qa
# yum list installed

Find out if httpd pack­age installed or not, enter:
# rpm -qa | grep httpd*
# yum list installed httpd

Task: Check for and update spe­cified pack­ages

# yum update {package-name-1}
To check for and update httpd pack­age, enter:
# yum update httpd

Task: Search for pack­ages by name

Search httpd and all match­ing perl pack­ages, enter:
# yum list {package-name}
# yum list {regex}
# yum list httpd
# yum list perl*

Sample out­put:

Loading "installonlyn" plugin
Loading "security" plugin
Setting up repositories
Reading repository metadata in from local files
Installed Packages
perl.i386                                4:5.8.8-10.el5_0.2     installed
perl-Archive-Tar.noarch                  1.30-1.fc6             installed
perl-BSD-Resource.i386                   1.28-1.fc6.1           installed
perl-Compress-Zlib.i386                  1.42-1.fc6             installed
perl-DBD-MySQL.i386                      3.0007-1.fc6           installed
perl-DBI.i386                            1.52-1.fc6             installed
perl-Digest-HMAC.noarch                  1.01-15                installed
perl-Digest-SHA1.i386                    2.11-1.2.1             installed
perl-HTML-Parser.i386                    3.55-1.fc6             installed
.....
.......
..
perl-libxml-perl.noarch                  0.08-1.2.1             base
perl-suidperl.i386                       4:5.8.8-10.el5_0.2     updates

Task: Install the spe­cified pack­ages [ RPM(s) ]

Install pack­age called httpd:
# yum install {package-name-1} {package-name-2}
# yum install httpd

Task: Remove /​ Unin­stall the spe­cified pack­ages [ RPM(s) ]

Remove pack­age called httpd, enter:
# yum remove {package-name-1} {package-name-2}
# yum remove httpd

Task: Dis­play the list of avail­able pack­ages

# yum list all

Task: Dis­play list of group soft­ware

Type the fol­low­ing com­mand:
# yum grouplist
Out­put:

Installed Groups:
   Engineering and Scientific
   MySQL Database
   Editors
   System Tools
   Text-based Internet
   Legacy Network Server
   DNS Name Server
   Dialup Networking Support
   FTP Server
   Network Servers
   Legacy Software Development
   Legacy Software Support
   Development Libraries
   Graphics
   Web Server
   Ruby
   Printing Support
   Mail Server
   Server Configuration Tools
   PostgreSQL Database
Available Groups:
   Office/Productivity
   Administration Tools
   Beagle
   Development Tools
   GNOME Software Development
   X Software Development
   Virtualization
   GNOME Desktop Environment
   Authoring and Publishing
   Mono
   Games and Entertainment
   XFCE-4.4
   Tomboy
   Java
   Java Development
   Emacs
   X Window System
   Windows File Server
   KDE Software Development
   KDE (K Desktop Environment)
   Horde
   Sound and Video
   FreeNX and NX
   News Server
   Yum Utilities
   Graphical Internet
Done

Task: Install all the default pack­ages by group

Install all ‘Devel­op­ment Tools’ group pack­ages, enter:
# yum groupinstall "Development Tools"

Task: Update all the default pack­ages by group

Update all ‘Devel­op­ment Tools’ group pack­ages, enter:
# yum groupupdate "Development Tools"

Task: Remove all pack­ages in a group

Remove all ‘Devel­op­ment Tools’ group pack­ages, enter:
# yum groupremove "Development Tools"

Task: Install par­tic­u­lar archi­tec­ture pack­age

If you are using 64 bit RHEL ver­sion it is pos­sible to install 32 pack­ages:
# yum install {package-name}.{architecture}
# yum install mysql.i386

Task: Dis­play pack­ages not installed via offi­cial RHN sub­scribed repos

Show all pack­ages not avail­able via sub­scribed chan­nels or repos­it­or­ies i.e show pack­ages installed via oth­er repos:
# yum list extras
Sample out­put:

Loading "installonlyn" plugin
Loading "security" plugin
Setting up repositories
Reading repository metadata in from local files
Extra Packages
DenyHosts.noarch                         2.6-python2.4          installed
VMwareTools.i386                         6532-44356             installed
john.i386                                1.7.0.2-3.el5.rf       installed
kernel.i686                              2.6.18-8.1.15.el5      installed
kernel-devel.i686                        2.6.18-8.1.15.el5      installed
lighttpd.i386                            1.4.18-1.el5.rf        installed
lighttpd-fastcgi.i386                    1.4.18-1.el5.rf        installed
psad.i386                                2.1-1                  installed
rssh.i386                                2.3.2-1.2.el5.rf       installed

Task: Dis­play what pack­age provides the file

You can eas­ily find out what RPM pack­age provides the file. For example find out what provides the /​etc/​passwd file:
# yum whatprovides /etc/passwd
Sample out­put:

Loading "installonlyn" plugin
Loading "security" plugin
Setting up repositories
Reading repository metadata in from local files
setup.noarch                             2.5.58-1.el5           base
Matched from:
/etc/passwd
setup.noarch                             2.5.58-1.el5           installed
Matched from:
/etc/passwd

You can use same com­mand to list pack­ages that sat­is­fy depend­en­cies:
# yum whatprovides {dependency-1} {dependency-2}
Refer yum com­mand man page for more inform­a­tion:
# man yum

Related Post

admin has written 133 articles