Useful yum commands

Basic syntax:

yum install <package1> <package2> ...
yum remove <package1> <package2> ...
yum list all

For example installing packages telnet, which, and perl.

yum -y install telnet which perl

To display a list of updated packages:

yum list updates

To list all installed packages:

yum list installed

OR

rpm -qa

To find out if package httpd is installed:

yum list installed httpd

OR

rpm -qa | grep httpd*

To list packages by group:

yum grouplist

Output:

# yum grouplist
Loaded plugins: fastestmirror
Setting up Group Process
Loading mirror speeds from cached hostfile
 * base: linux.mirrors.es.net
 * updates: mirrors.easynews.com
 * addons: mirrors.kernel.org
 * extras: mirror.anl.gov
base                                                                         | 1.1 kB     00:00
updates                                                                      |  951 B     00:00
addons                                                                       |  951 B     00:00
extras                                                                       | 1.1 kB     00:00
comps.xml                                                                    | 914 kB     00:05
yumgroups.xml                                                                | 9.7 kB     00:00
Installed Groups:
   Yum Utilities
Available Groups:
   Administration Tools
   Authoring and Publishing
   Base
   Beagle
   Cluster Storage
   Clustering
   DNS Name Server
   Development Libraries
   Development Tools
   Dialup Networking Support
   Editors
   Emacs
   Engineering and Scientific
   FTP Server
   FreeNX and NX
   GNOME Desktop Environment
   GNOME Software Development
   Games and Entertainment
   Graphical Internet
   Graphics
   Horde
   Java
   Java Development
   KDE (K Desktop Environment)
   KDE Software Development
   Legacy Network Server
   Legacy Software Development
   Legacy Software Support
   Mail Server
   Mono
   MySQL Database
   Network Servers
   News Server
   Office/Productivity
   OpenFabrics Enterprise Distribution
   PostgreSQL Database
   Printing Support
   Ruby
   Server Configuration Tools
   Sound and Video
   System Tools
   Text-based Internet
   Tomboy
   Virtualization
   Web Server
   Windows File Server
   X Software Development
   X Window System
   XFCE-4.4
Done

To install all the default packages by group:

yum groupinstall "Development Tools"

To update all the default packages by group:

yum groupupdate "Development Tools"

To remove all packages in a group:

yum groupremove "Development Tools"