yum command: Update / Install Packages Under Redhat Enterprise / CentOS Linux Version 5.x

by Vivek Gite · 19 comments

How do I use yum command to update and patch my Red hat Enterprise Linux / CentOS Linux version 5.x server via RHN / Internet? Can I use up2date command under RHEL 5?

up2date command was part of RHEL v4.x or older version. You need to use yum command to update and patch the system using RHN or Internet. Use yum command to install critical and non-critical security updates as well as binary packages. Login as the root user to install and update the system.

Task: Register my system with RHN

To register your system with RHN type the following command and just follow on screen instructions (CentOS user skip to next step):
# rhn_register

WARNING! These examples only works with RHEL / CentOS Linux version 5.x or above. For RHEL 4.x and older version use up2date command.

Task: Display list of updated software (security fix)

Type the following command at shell prompt:
# yum list updates

Task: Patch up system by applying all updates

To download and install all updates type the following command:
# yum update

Task: List all installed packages

List all installed packages, enter:
# rpm -qa
# yum list installed

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

Task: Check for and update specified packages

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

Task: Search for packages by name

Search httpd and all matching perl packages, enter:
# yum list {package-name}
# yum list {regex}
# yum list httpd
# yum list perl*

Sample output:

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 specified packages [ RPM(s) ]

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

Task: Remove / Uninstall the specified packages [ RPM(s) ]

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

Task: Display the list of available packages

# yum list all

Task: Display list of group software

Type the following command:
# yum grouplist
Output:

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 packages by group

Install all 'Development Tools' group packages, enter:
# yum groupinstall "Development Tools"

Task: Update all the default packages by group

Update all 'Development Tools' group packages, enter:
# yum groupupdate "Development Tools"

Task: Remove all packages in a group

Remove all 'Development Tools' group packages, enter:
# yum groupremove "Development Tools"

Task: Install particular architecture package

If you are using 64 bit RHEL version it is possible to install 32 packages:
# yum install {package-name}.{architecture}
# yum install mysql.i386

Task: Display packages not installed via official RHN subscribed repos

Show all packages not available via subscribed channels or repositories i.e show packages installed via other repos:
# yum list extras
Sample output:

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: Display what package provides the file

You can easily find out what RPM package provides the file. For example find out what provides the /etc/passwd file:
# yum whatprovides /etc/passwd
Sample output:

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 command to list packages that satisfy dependencies:
# yum whatprovides {dependency-1} {dependency-2}
Refer yum command man page for more information:
# man yum

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 19 comments… read them below or add one }

1 Fil 01.14.09 at 11:44 pm

Is it possible to update a red hat enterprise 5, without red hat network registration??

Thanks

2 santosh 04.08.09 at 2:23 pm

Hello there

Hi am having problem entering graphic mode in RHEL 5.0,
When am booting into os, It coming up with an error
Cant find x-server, Try to install x-server….
and then it going to text mode for a min and throwing that error
Can any one help me plssss

thnx in advance

3 mohan 04.14.09 at 7:00 am

Hi santosh

allready u gone text mode u give command init 5 it is find graphical mode

4 mohan 04.14.09 at 7:04 am

Hello there

Hi am having problem entering graphic mode in RHEL 5.0,
When am booting into os, It coming up with an error
Cant find x-server, Try to install x-server….
and then it going to text mode for a min and throwing that error
Can any one help me plssss

thnx in advance

5 Yum 05.06.09 at 2:05 pm

It is possible to configure yum to install rpms from local media, using the following method:

1. Create a new repository file: /etc/yum.repos.d/local.repo

2. Type the following:

[local]
name=Red Hat Local Repository
baseurl=file:///media/RHEL_5.3%20i386%20DVD/Server
enabled=1
gpgcheck=0

The baseurl should be web-encoded (ie space=%20) point to the local media which contains the rpms to install and any dependent rpms, and the folder repodata/ with repomd.xml and TRANS.TBL.

3. Finally, run (as root):

yum install [package]

6 manidhar karan 06.20.09 at 6:13 am

thanks to hellp

7 PCMaind 07.08.09 at 11:29 am

hi,
this is to better commands of other command
bcoz another commands are so hard it is true
and this commands is very simple .

so thanks for this commands,
bye tc , have good day all .

8 PCMaind 07.08.09 at 11:34 am

i have a problem about a ubuntu (linux),
the error show, when i insert a disk of film in dvdrom then the error shows

the PlayBack of this movie requires a VCD protocol source plugin which is not installed

plz give me a solucation about this error.

9 milan 07.12.09 at 9:10 am

4 yum installation
stp1- cp /etc/yum.repos.d/rhel(press tab) /etc/yum.repos.d/Server.repo
stp2- vi /etc/yum.reppos.d/Server.repo
stp3- in 3rd lin after ftp giv //ur machine ip/pub/Server (becz my Server is copy 2 pub)
stp4- createrepo -v /var/ftp/pub/Server
stp5- service vsftpd restart
stp6- yum update
thank u i am 2nd year eng student

10 adeniyi morakinyo 08.12.09 at 2:21 pm

i have this error when instaling yum

# yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named sqlitecachec

Please install a package which provides this module, or
verify that the module is installed correctly.

It’s possible that the above module doesn’t match the
current version of Python, which is:
2.4.3 (#1, Jan 14 2008, 18:32:40)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

11 ashish 08.20.09 at 8:21 am

This is wonderful way to learn possible problems.
great……………….

12 tosa 08.21.09 at 9:42 pm

I had installed yum from package cd.
I am having dell inspiron 1525 and have problem in running wifi , so can yum help me to install my wifi drivers compatible to my machine.

13 The Doctor 10.30.09 at 3:45 pm

Thank you for this post. I didn’t know about the ‘groupremove’ function of YUM. That’s going to save HOURS of time later!

14 phanindra 11.11.09 at 6:59 am

Hi hello, this is phanindra
I am having dell latitude 510 lappy and having a problem in running wifi, so can u help me hou to install the wifi drivers tat r compatible to my machine

15 sivaraj 12.02.09 at 8:21 am

how to take system backup on centos through graphical mode

16 charanjit 12.11.09 at 12:22 pm

Hi,

I want to whats the command to install all the RPMS in one command in RHEL5.

Thanks

17 kamla nand raman 12.28.09 at 4:44 am

This is the best class architecture of installation of yum.

thanks,
your team…

18 Ashish bachchan 01.27.10 at 10:51 pm

I’m having problem in installing VLC media player can someone help me I’ll gratefull to the person.
I’ve even configured YUM but still I think there is something to know that I don’t so please some body help me ………….
plzzzzzzzzzzzzzz

Ashish Bachchan

19 gulshah 02.03.10 at 11:59 am

thanks allot

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All