yum command: Update / Install Packages

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@daddylinux~]# rhn_register

Task: Display list of updated software (security fix)
Type the following command at shell prompt:
[root@daddylinux~]# yum list updates
Task: Patch up system by applying all updates
To download and install all updates type the following command:
[root@daddylinux~]# yum update

Task: List all installed packages
List all installed packages, enter:
[root@daddylinux~]# rpm -qa
[root@daddylinux~]# yum list installed

Find out if httpd package installed or not, enter:
[root@daddylinux~]# rpm -qa | grep httpd*
[root@daddylinux~]# yum list installed httpd

Task: Check for and update specified packages
[root@daddylinux~]# yum update {package-name-1}

To check for and update httpd package, enter:
[root@daddylinux~]# yum update httpd

Task: Search for packages by name
Search httpd and all matching perl packages, enter:
[root@daddylinux~]# yum list {package-name}
[root@daddylinux~]# yum list {regex}
[root@daddylinux~]# yum list httpd
[root@daddylinux~]# yum list perl*

Task: Install the specified packages [ RPM(s) ]
Install package called httpd:
[root@daddylinux~]# yum install {package-name-1} {package-name-2}
[root@daddylinux~]# yum install httpd

Task: Remove / Uninstall the specified packages [ RPM(s) ]
Remove package called httpd, enter:
[root@daddylinux~]# yum remove {package-name-1} {package-name-2}
[root@daddylinux~]# yum remove httpd

Task: Display the list of available packages
[root@daddylinux~]# yum list all

Task: Display list of group software
Type the following command:
[root@daddylinux~]# yum grouplist

Task: Install all the default packages by group
Install all 'Development Tools' group packages, enter:
[root@daddylinux~]# yum groupinstall "Development Tools"

Task: Update all the default packages by group
Update all 'Development Tools' group packages, enter:
[root@daddylinux~]# yum groupupdate "Development Tools"

Task: Remove all packages in a group
Remove all 'Development Tools' group packages, enter:
[root@daddylinux~]# 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@daddylinux~]# yum install {package-name}.{architecture}
[root@daddylinux~]# 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@daddylinux~]# 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@daddylinux~]# yum whatprovides /etc/passwd

You can use same command to list packages that satisfy dependencies:
[root@daddylinux~]# yum whatprovides {dependency-1} {dependency-2}

Refer yum command man page for more information:
[root@daddylinux~]# man yum

Special thanks for nixCraft (Source)

4 comments:

Post a Comment