Using yum command on CentOS / RedHat

by lifeLinux on April 30, 2011

yum is an interactive, automated update program which can be used for maintaining systems using rpm.

Synopsis

yum [options] [command] [package ...]


The following is a list of the most commonly used yum commands:

Install a package

yum install [package name]

Used to install the latest version of a package or group of packages. If no package matches the specified package name(s), they are assumed to be a shell glob, and any matches are then installed.

Update the specified packages

yum update [package name]

Used to update the specified packages to the latest available version. If no package name/s are specified, then yum will attempt to update all installed packages.

Check update

yum check-update

This command allows you to determine whether any updates are available for your installed packages. yum returns a list of all package updates from all repositories if any are available.

Remove a package

yum remove [package name]

Used to remove specified packages, along with any other packages dependent on the packages being removed.

Determine which packages provide a specific file or feature

yum provides [file name]

Find any packages containing the specified keyword

yum search [keyword]

This command is used to find any packages containing the specified keyword in the description, summary, packager and package name fields of RPMs in all repositories.

For a complete list of available yum commands, refer to man yum.

man yum

Sample outputs:

NAME
       yum - Yellowdog Updater Modified

SYNOPSIS
       yum [options] [command] [package ...]

DESCRIPTION
       yum  is an interactive, rpm based, package manager. It can automatically perform system updates, including dependency analysis and obsolete pro-
       cessing based on "repository" metadata. It can also perform installation of new packages, removal of old packages and  perform  queries  on  the
       installed  and/or  available  packages  among many other commands/services (see below). yum is similar to other high level package managers like
       apt-get and smart.

       While there are some graphical interfaces directly to the yum code, more recent graphical interface development is happening with PackageKit and
       the gnome-packagekit application.

       command is one of:
        * install package1 [package2] [...]
        * update [package1] [package2] [...]
        * check-update
        * upgrade [package1] [package2] [...]
        * remove | erase package1 [package2] [...]
        * list [...]
        * info [...]
        * provides | whatprovides feature1 [feature2] [...]
        * clean [ packages | headers | metadata | dbcache | all ]
        * makecache
        * groupinstall group1 [group2] [...]
        * groupupdate group1 [group2] [...]
        * grouplist [hidden] [groupwildcard] [...]
        * groupremove group1 [group2] [...]
        * groupinfo group1 [...]
        * search string1 [string2] [...]
        * shell [filename]
        * resolvedep dep1 [dep2] [...]
        * localinstall rpmfile1 [rpmfile2] [...]
        * localupdate rpmfile1 [rpmfile2] [...]
...

Example: Install LAMP with single command by yum

Enter the following command:

yum install httpd mysql mysql-server php 

Related Posts:

Leave a Comment

Previous post:

Next post: