MDLog:/sysadmin

The Journal Of A Linux Sysadmin

Yum – Covering the Basics, Adding Repositories

| Comments

My first contribution to the site will cover some basics about yum (so Debian users can skip this, sorry for that). Yum is the standard package manager of CentOS and Fedora Core. It is used for maintenance of your software on your system. Most common tasks are installing and removing software on your system. In the background yum can update all software and – very important – can solve software dependencies automatically (a thing, the simple RPM command can’t do). Solving software dependencies means: yum knows when program A needs program B to work and will also install program B if you choose to install program A.

For the proper function of yum, yum needs to know what software it can install and maintain and, of course, where to find it. In package manager terms this is called a “repository”. Your installation CD/DVD is a repository for example. But a lot more interesting are repositories on the internet. These can provide (security) updates to existing software on your system and extra software which is not available on your installation CDs/DVD. And, of course, you can use different repositories together.

So let’s add a new repository to yum. On CentOS 4, each repository has an extra file in the directory “/etc/yum.repos.d”. On other systems, you may have to add the repositories directly to “/etc/yum.conf”

1
2
cd /etc/yum.repos.d
nano dag.repo

Fill in the following lines and save it.

1
2
3
4
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

Here, I am using the famous repository of Dag Wieers. It contains very useful tools and addons for CentOS/Red Hat compatible systems. A good example of Dag’s repository is the famous mail reader pine which is not included on the CentOS 4 installation CDs/DVD. We will install it lateron. My configuration example of Dag’s repository should be pretty self-explaining. Normally, every yum repository on the internet has a website that provides information with the correct configuration for their repository. At least, you will find data for the “baseurl” parameter.

Many repositories – like Dag – also digitally sign their packages to prevent modifications from hackers. To enable this check, “gpgcheck” must be set to “1” (like above), but you will also need to import the GPG key from the repository to make it work correctly. To import the GPG key from Dag, type:

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

Now, we can beginn installing software. Let’s take pine for example.

1
yum install pine

Easy as that. And to remove it (yes, you guessed right):

1
yum remove pine

To search for software across all repositories:

1
yum search _program name_

So, that’s all for today. In the future, I am planning another article about yum, covering some more advanced functions and bringing some more useful repositories to you to satisfy all your software needs :–)

Comments