Monday, February 18, 2008

CentOS Repositories


What is a Repository?


A software repository (sometimes abbreviated as a repo) is a storage location from which software packages may be retrieved and installed on a computer. Many software publishers and other organizations maintain servers on the Internet for this purpose, either free of charge or for a subscription fee.

CentOS Software Repositories ( Official )

Base repo - The packages that comes with the release media. ( CDs or the DVD )

Addons repo - The packages used/produced in the build but not released with the release media

Extras repo - The additional packages that may be useful

Updates repo - The updated packages of the above repos

Centosplus repo - This repository is for items that actually upgrade certain base CentOS components. This repo will change CentOS to not be exactly like the upstream providers content

Website - http://mirror.centos.org/centos-5/5

The above Base repo, Addons repo, Extras repo, Updates repo are 100% compatible with RHEL, where as Centosplus repo is NOT 100% compatible with RHEL, so by default it's disabled.

CentOS Software Repositories ( 3rd Party )

**NOT maintained by official OS developers, but contains lots of helpful packages, 100% compatible with RHEL and CentOS.

RPMForge repo - This repository is a collaboration of Dag, Dries, and other packagers. They provide over 2600 packages for CentOS

Website - http://dag.wieers.com/rpm/packages.php

Fedora Extra Packages for Enterprise Linux (EPEL) repo - This repository provides rebuilds of Fedora packages for RHEL4 and RHEL5

Website for i386 packages - http://download.fedora.redhat.com/pub/epel/5/i386/repoview
Website for x64 packages - http://download.fedora.redhat.com/pub/epel/5/x86_64/repoview

How to use the CentOS Repositories?

In CentOS and RHEL to use the repositories we have to use a software management tool call "YUM" ( Yellow dog Updater, Modified ), the tool needs the repository information to manage software within your system. The information about the official repositories comes by default with YUM, but information about 3rd party repositories we have to manually configure.

The location of the repository information

# cd /etc/yum.repos.d
# ls -l

-rw-r--r-- 1 root root 2049 Nov 23 07:02 CentOS-Base.repo
-rw-r--r-- 1 root root 622 Nov 23 07:02 CentOS-Media.repo

CentOS-Base.repo file contains the information about the official CentOS repositories. To use the repos you have to have a live Internet connection.

CentOS-Media.repo file contaions the information about the packages included in the official CDs or the DVD, This you can use if you don't have internet.

How to use 3rd party Repositories?

You have to be careful, because in the 3rd party repos we might find packages that are already present in the official repos, we have to make sure we are NOT overlapping the packages, so this is how to do it.

1. Install "yum-priorities" plugin for YUM, this plugin will help you to prioritize the each repository that you use in the system, so we can give a high priority to official repositories and low priority to 3rd party repositories, so the packages in the 3rd party repos won't overlap the packages in the official repos.

# yum install yum-priorities

2. Then open the official yum repo information file

# nano /etc/yum.repos.d/CentOS-Base.repo

3. At the end of each heading, put like this

[base]
.
.
.
priority=1

[updates]
.
.
.
priority=1

[addons]

.
.
.
priority=1

[extras]

.
.
.
priority=1

[centosplus]

.
.
.
priority=2

What we have done above is, we have given priority=1 to [base], [updates], [addons] and [extras] repositories and priority=2 to [centosplus] repository, so [centosplus] repository packages won't overlap with [base], [updates], [addons] and [extras] repository packages.

4. Then we can install 3rd party repositories, first we'll configure RPMForge repo. All 3rd party repos can be configured by installing their release RPM. So to configure RPMForge, download and install the following packages.

for i386 - http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

for x64 - http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

5. Then check the location of the repository information and edit the rpmforge.repo file as follows.

# cd /etc/yum.repos.d
# ls -l

-rw-r--r-- 1 root root 2049 Nov 23 07:02 CentOS-Base.repo
-rw-r--r-- 1 root root 622 Nov 23 07:02 CentOS-Media.repo
-rw-r--r-- 1 root root 684 Mar 8 2007 mirrors-rpmforge
-rw-r--r-- 1 root root 428 Mar 8 2007 rpmforge.repo

# nano rpmforge.repo

[rpmforge]
.
.
.
priority=11

When we do this, the packages in RPMForge won't overwire packages in our official repos.

6. Then we'll install Fedora Extra Packages for Enterprise Linux (EPEL) repo, download and install the following package.

for i386 / x86_64 - http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm

7. Then check the location of the repository information and edit the epel.repo file as follows.

# cd /etc/yum.repos.d
# ls -l

-rw-r--r-- 1 root root 2049 Nov 23 07:02 CentOS-Base.repo
-rw-r--r-- 1 root root 622 Nov 23 07:02 CentOS-Media.repo
-rw-r--r-- 1 root root 954 Apr 3 2007 epel.repo
-rw-r--r-- 1 root root 771 Apr 3 2007 epel-testing.repo
-rw-r--r-- 1 root root 684 Mar 8 2007 mirrors-rpmforge
-rw-r--r-- 1 root root 428 Mar 8 2007 rpmforge.repo

# nano epel.repo

[epel]
.
.
.
priority=12

When we do this, the packages in Fedora Extra Packages for Enterprise Linux (EPEL) repo won't overwire packages in RPMForge repo or official repos.

8. Now your system ready to manage software packages.