Jan 312015

So you’ve installed CentOS on your computer and have it up and running without any issues.

Good job!

Now we can move to another key step in your CentOS learning adventure – Adding more repositories.

For purposes of this post, it doesn’t matter whether you’ve installed the older CentOS 6.6 or the newer CentOS 7.0.

What is a Repository?

As a newbie, you might be forgiven for wondering what the heck a repository is in Linux.

Think of a repository as a central location from where you can download software packages to your system.

Why are repositories important?

When you first install a Linux distribution (CentOS, RedHat, Oracle Linux, Scientific Linux etc), you usually get only a limited set of packages with it. But later you might feel the need for a software package that might not available in the CentOS base repository. So you look to third party repositories for the packages you want.

A repository often contains thousands of software packages ranging from browsers to RSS readers to text editors to more complex stuff like IDEs (integrated development environments).

The beauty of Linux is its flexibility, which lets you add or delete any package you want later.

When you download a package from a repository using commands like yum install package_name (for RedHat, CentOS and Fedora systems) or apt-get install package_name (for Debian, Ubuntu and LinuxMint systems), they are downloaded from a repository and you get dependency resolution automatically. Dependencies are other programs that must be installed for your desired package to work properly.

So when you install the Libre Office package from a repository, you also automatically get other software components that are required for Libre Office to work well.

Bear in mind that packages and repositories are distribution specific.

For instance, the popular EPEL repository is meant for users running Fedora, CentOS or Red Hat and not for those who have deployed Debian, Ubuntu or LinuxMint on their servers or desktop computers. Ditto with packages. Those meant for Debian and its derivatives will not work on CentOS, RedHat or Fedora and vice versa.

Good as the base CentOS and Red Hat Enterprise Linux repositories are, they are not comprehensive. As a matter of fact, no single repository is ever comprehensive enough.

So there arises the need to install other repositories like EPEL (an acronym for Extra Packages for Enterprise Linux), IUS, ELRepo, ATrpms etc.

Before you go about installing other repositories, first check what’s installed on your computer with yum repolist all.

The below command should provide a list of all repositories (both enabled and disabled) on your CentOS system:

michael@centos-guru ~]# yum repolist all

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.osuosl.org
* extras: mirror.cc.columbia.edu
* updates: mirror.es.its.nyu.edu
repo id repo name status
base CentOS-6 – Base 6,518
extras CentOS-6 – Extras 36
updates CentOS-6 – Updates 565
repolist: 7,119

Now that you know what repositories are available on your computer you can install whichever repository you want.

Let’s install EPEL, a well supported repository for CentOS, Fedora and RedHat Linux distributions

Responsibility for maintaining EPEL rests with the Fedora Special Interest Group.

How to Install EPEL

Installing EPEL repository on a CentOS or RedHat desktop or server is easy when you follow the below steps.

EPEL on CentOS 6.6

Before installing the EPEL repository, make sure you’re on root and then run the below commands (depending on whether you’re running 32-bit or 64-bit CentOS and the version):

For 32-bit CentOS 6.x Systems

$ wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6*.rpm

For 64-bit CentOS 6.x Systems

$ wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6*.rpm

EPEL on 64-bit CentOS 7.x

CentOS 7.x has no 32-bit version, just the 64-bit distribution.

This is how you install the EPEL repository on CentOS 7.x.

$ wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
sudo rpm -Uvh epel-release-7*.rpm

By using a similar methodology (with appropriate changes to the repository source links, of course), you can install other popular repositories like IUS (IUS Community Packages for Enterprise Linux 6), ElRepo (The Community Enterprise Linux Repository) etc on your CentOS system.

Repositories – Enabled & Disabled

But there’s more to using a repository than just downloading it.

Let’s consider a few key commands you ought to be familiar with vis-a-vis repositories on a CentOS system.

If you want to check the list of all repositories on your system (both enabled and disabled), the command to run is:

# yum repolist all

The below command will display only enabled repositories:

# yum repolist enabled

To see a list of disabled repositories, run the following command:

# yum repolist disabled

How to Enable/Disable a CentOS Repository

There might be occasions when you have a change of mind and decide to disable a CentOS repository that you’d previously installed and enabled.

To disable a repository (say EPEL) on CentOS, run the below command:

# sudo yum-config-manager --disable epel

If you want to enable a repository (say EPEL) on CentOS, issue the below command:

# sudo yum-config-manager --enable epel

Packages in EPEL

EPEL consists of tons of software packages.

Once you’ve installed EPEL on your computer, you can get a list of packages available on EPEL by issuing the below command:

 $yum --disablerepo="*" --enablerepo="epel" list available

The list of packages is fairly long, so I’d recommend copying it to a text file so that you can pore over it at leisure.

To copy the list of EPEL packages to your desktop in a text file, issue the following command (but remember to change ‘michael to your user name).

yum --disablerepo="*" --enablerepo="epel" list available > /home/michael/Desktop/epel-repo-packages.txt

Knowing how to deploy repositories and use them to your advantage is an important step in developing expertise in CentOS or related distributions like RedHat, Fedora, Oracle Linux and Scientific Linux.

Related Content on CentOS Repositories:
Various Repositories Available for CentOS

Sorry, the comment form is closed at this time.