yum command: Update / Install Packages under /RHEL / CentOS Linux Version 5.x
Q. 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?
A. 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):
[root@server ~]# rhn_register
Task: Display list of updated software (security fix)
Type the following command at shell prompt:
[root@server ~]# yum list updates
Task: Patch up system by applying all updates
To download and install all updates type the following command:
[root@server ~]# yum update
Task: List all installed packages
List all installed packages, enter:
[root@server ~]# rpm -qa
[root@server ~]# yum list installed
Find out if httpd package installed or not, enter:
[root@server ~]# rpm -qa | grep httpd*
[root@server ~]# yum list installed httpd
Task: Check for and update specified packages
[root@server ~]# yum update {package-name-1}
To check for and update httpd package, enter:
[root@server ~]# yum update httpd
Task: Search for packages by name
Search httpd and all matching perl packages, enter:
[root@server ~]# yum list {package-name}
[root@server ~]# yum list {regex}
[root@server ~]# yum list httpd
[root@server ~]# yum list perl*
Task: Install the specified packages [ RPM(s) ]
Install package called httpd:
[root@server ~]# yum install {package-name-1} {package-name-2}
[root@server ~]# yum install httpd
Task: Remove / Uninstall the specified packages [ RPM(s) ]
Remove package called httpd, enter:
[root@server ~]# yum remove {package-name-1} {package-name-2}
[root@server ~]# yum remove httpd
Task: Display the list of available packages
[root@server ~]# yum list all
Task: Display list of group software
Type the following command:
[root@server ~]# yum grouplist
Task: Install all the default packages by group
Install all 'Development Tools' group packages, enter:
[root@server ~]# yum groupinstall "Development Tools"
Task: Update all the default packages by group
Update all 'Development Tools' group packages, enter:
[root@server ~]# yum groupupdate "Development Tools"
Task: Remove all packages in a group
Remove all 'Development Tools' group packages, enter:
[root@server ~]# yum groupremove "Development Tools"
Task: Install particular architecture package
If you are using 64 bit RHEL version it is possible to install 32 packages:
[root@server ~]# yum install {package-name}.{architecture}
[root@server ~]# 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:
[root@server ~]# yum list extras
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:
[root@server ~]# yum whatprovides /etc/passwd
You can use same command to list packages that satisfy dependencies:
[root@server ~]# yum whatprovides {dependency-1} {dependency-2}
Refer yum command man page for more information:
[root@server ~]# man yum
Special thanks for nixCraft
------------------------------------------------------------------------------------------