How do I use Yum?

Last updated: March 26, 2011

Yum is very intuitive and easy to use yet it is very powerful.

You can use yum to install software from a repository, see what is currently installed, see what has updates available, update selected software or everything installed, see what dependencies are tied to a package, see what package a service or software is a part of and also remove packages and all associated dependencies.

When you install something using yum you have a reliable upgrade path so as the software or service gets updated by the developers for security or new features it's easy for you to keep your installs up to date as opposed to installing from source where you have to manage all the aspects of dependencies and integration. The more you use yum the more you will realize how much time it saves you.

The the files that contain the connection info for the repos that yum will look to for packages are in:

/etc/yum.repos.d/

Repos can be public or private allowing you to have your own network based location for your own repos letting you have total control over your deployments if required.

Want to search the repos for something specific like php?
# yum list php

Want to expand that just a bit use a wildcard:
# yum list php*

To install a package
# yum install <package name>

To install a package automatically and have it not ask y/n
# yum install <package name> -y

To list all installed/non installed packages
# yum list all

To get the details of a package
# yum info <package name>

To list the installed packages
# yum list installed

To list the available packages for installing
# yum list available

To remove a package
# yum remove <package name>

Yum maintains a cache. Each repositories have their own cache.

To clear the cache
# yum clean all

Tags: yum, linux, rpm, update