Friday, October 8, 2010

Yum Repositories for RHEL 5

Sometimes we need a RHEL5 Repository that includes software not released by Redhat. It may be that we need a newer version, or simply something that was not included in our installation, and is not part of the standard redhat repositories.

Missing RPM

Have you ever tried to install something with yum, only to find that the package is not available?

$sudo yum -y install vlc
Password:
Server | 1.3 kB 00:00
Updates | 951 B 00:00
Workstation | 1.1 kB 00:00
addons | 951 B 00:00
base | 2.1 kB 00:00
extras | 2.1 kB 00:00
update | 1.9 kB 00:00
Excluding Packages in global exclude list
Finished
Setting up Install Process
No package vlc available.
Nothing to do
$

Install New Repos

The solution is simple, if you add the repo files for repositories that contain the missing package.

Repo files are located in the /etc/yum.repos.d directory.

$ pwd
/etc/yum.repos.d

Here are some of my favorites:


Quick Install

A quick way to install the repoforge settings, is to download the package for your distro, and install the it.  That will place the required files in the /etc/yum.repos.d/ directory.

  http://repoforge.org/use/
  rpm -Uvh rpmforge-relese-x.x.x-x....

e.g., for RHEL5, i686:
$ wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
$ sudo rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

Dag Wieers' repository

Much of the software you need can be found here.

$ cat r5.dag.repo

[dag]
name=Red Hat Enterprise Linux 5 Dag Wieers' repository
baseurl=http://apt.sw.be/redhat/el5/en/i386/dag/
http://ftp.heanet.ie/pub/freshrpms/pub/dag/redhat/el5/en/i386/dag/

CentOS-5

Very useful for missing libraries. Be aware that this may replace some redhat libraries, but it should be binary compatible.

$ cat CentOS-Base.repo
[base]
name=CentOS-5 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&
repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates
[update]
name=CentOS-5 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons

baseurl=http://mirrors.163.com/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras

baseurl=http://mirrors.163.com/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://mirrors.163.com/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://mirrors.163.com/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

ATrpms

$ cat atrpm.repo
[atrpms]
name=Red Hat Enterprise Linux 5 $releasever - $basearch - ATrpms
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1

RPMforge

$ cat rpmforge.repo
### Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = Red Hat Enterprise $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

$ cat rpmforge-testing.repo
### Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag
### URL: http://rpmforge.net/
[rpmforge-testing]
name = Red Hat Enterprise $releasever - RPMforge.net - test
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/test
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 0

How to Add Repositories

You may be wondering how to make use of these repos. Simply create the files listed above with a text editor, and place them in the /etc/yum.repos.d directory.

Now when you use yum to install, there should be more rpms available, and less dependency issues. For example, the following should now work on a RHEL5 system with no errors. (This was tested on RHEL5U2 and RHEL5U4).

$sudo yum -y install vlc