Yum – Covering the basics, adding Repositories
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â€
cd /etc/yum.repos.d
nano dag.repo
Fill in the following lines and save it.
[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:
rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
Now, we can beginn installing software. Let’s take pine for example.
yum install pine
Easy as that. And to remove it (yes, you guessed right):
yum remove pine
To search for software across all repositories:
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 ![]()
Share This








11th September 2006, 18:51
Hi Cornelius,
)
I’m a Debian user but I will have to “manage” a RH-ES4 server…
It seems that Yum is officially only for Fedora ?
But Dag seems to provide also a Yum version for RHEL..
Does RedHat ES/AS provide an *official* tool like Yum for Fedora ?
Does the RedHat support is broken on ES/AS if using an unofficial tool (Dag Yum) to install unnoficial Rpm (Dag Rpm)?
(I know this question should be asked to RedHat, but I don’t have access to them for now…so may be as a (old?)RedHat user you know the answer)
(I hope to be able to remove RHES for Fedora or Debian but I need an official reason to do this
I hope these questions are not much “off topic”…
BTW, welcome and thank you for posting into ducea.com
12th September 2006, 07:41
>Hi Cornelius,
Hello G2!
>I’m a Debian user but I will have to “manage†a RH-ES4 server…
There are worse things that can happen
>It seems that Yum is officially only for Fedora ?
That’s right.
>But Dag seems to provide also a Yum version for RHEL..
Yes, he does. See http://dag.wieers.com/packages/yum/
>Does RedHat ES/AS provide an *official* tool like Yum for Fedora ?
No, they don’t. But you don’t need yum to use yum repositories. The official RHEL update tool “up2date” can be configured to use yum repositories. It’s already builtin!
To add Dag’s repository to “up2date” for example, edit /etc/sysconfig/rhn/sources and add the following line:
yum dag http://apt.sw.be/redhat/el4/en/ARCH/dag
Now import the GPG key from Dag (see my article) and that’s it. Now you can use up2date to install and update software from Dag’s repository. Easy, heh?
>Does the RedHat support is broken on ES/AS if using an unofficial >tool (Dag Yum) to install unnoficial Rpm (Dag Rpm)?
Yes and no. They don’t have any control over Dag’s repository, so they won’t support the RPMs you installed from there. But they will still have to support their own RPMs and their base system, that’s for sure. It’s normal to have 3rd party software installed. M$ also doesn’t say: Oh, you use Firefox, now you don’t get any support for the rest of the system. Got my point?
>(I hope to be able to remove RHES for Fedora or Debian but I need >an official reason to do this
)
If your aim is long term stability and easy maintenance, then stay with RHEL or use Debian, not Fedora. It’s easy to migate from RHES to CentOS (a free RHEL clone) without reinstalling if you don’t want to pay RH support. If your system is running stable on RHES, there’s no need to migrate to Debian. Takes too much time IMO and isn’t worth the effort. RHEL (or the free CentOS clone) is a good and well supported distribution.
>I hope these questions are not much “off topicâ€â€¦
They are not.
>BTW, welcome and thank you for posting into ducea.com
Thanks a lot.
12th September 2006, 18:37
Thank you very much for taking time to write these informations
15th October 2006, 22:33
Oh my goodness you have saved me the biggest ever headache of all time telling me how to use up2date as a RH “apt-get” on RHES! Thank you so much!
21st November 2006, 15:15
After doing your instructions, what does one do if this error message appears:
# yum install pine
Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
Error: Cannot find a valid baseurl for repo: dag
21st November 2006, 15:16
…nevermind, one checks that cut’n'paste didn’t omit carriage returns and line feeds.
30th December 2007, 03:09
Awesome, thanks.
And thanks to Walt - he showed me how to fix my problem
24th May 2008, 20:11
Awesome Tutorial! Helped me a great much!
~Ruezu
9th September 2008, 19:58
it almost works exactly as described except that this command (for importing gpg keys) is broken (well, not broken, but the key has been moved).
# rpm –import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
What’s happening is that the file was moved and a 301 redirect code was left in it’s place. Your browser will do the redirect seamlessly but the rpm command won’t. You’ll get a strange error. Anyway, I figured out what was happening curl. Issue this instead:
# rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt