How to setup and use YUM on Fedora Linux

by Sukrit Dhandhania on May 19, 2009

Linux

YUM is a very cool software installation and management tool for Red Hat Linux based systems. It makes installing new packages or updating existing ones a breeze by taking care of installing all the dependancies. Let’s look at how to set it up on a Fedora Linux machine and then how to use it.

If you don’t have YUM installed on your Linux machine then get it from project’s home page http://linux.duke.edu/projects/yum/download.ptml. After downloading the latest release of YUM for your version of Fedora Linux install it.

# rpm -ivh yum-2.0.3-0.fdr.1.rh90.noarch.rpm

Once installed correctly you should be able to access YUM from using the command yum. Lets configure YUM before we begin using it. The configuration basically consists of adding a number of RPM repositories so that YUM can fetch the RPM packages and dependent packages required. Open the /etc/yum.conf file in a text editor and add the following lines at the end of the file:

[base]
name=Fedora Core $releasever – $basearch – Base
baseurl=http://apt.sw.be/fedora/$releasever/en/$basearch/dag
baseurl=http://mirrors.kernel.org/fedora/core/$releasever/$basearch/os

Save the file and quit your text editor. Now install GPG signature key for this server with the following command:

# rpm –import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

You can add other repositories in a similar manner. Remember to install the GPG key for them if you do. Now update your YUM database so it contains the packages form the new repository:

# yum check-update

Now if you want to install a package all you have to do is run the command yum install followed by the package name. Say you want to install the package cowsay, run the following command:

# yum install cowsay

If this package is in any of the repositories you have listed in your yum.conf file, YUM will promptly install it along with any dependencies. If not, it will report that it’s not available.

If you want to update all the packages in your system run this command:

# yum update

If you want to upgrade a single package:

# yum update cowsay

To remove an installed package:

# yum remove cowsay

You can also get a list of all the packages installed on your computer using this command:

# yum list installed

To get a list of all the updates available for your system:

# yum list updates

YUM is a very powerful tool and it can make managing packages on a Linux system really simple. Ubuntu users may be familiar with apt-get, a similar automated package installation tool. If you have a large number of Linux machines in your network you can optionally setup a local YUM repository which can save you a lot of bandwidth.