Search My Techie Guy

Tuesday, July 15, 2014

Enabling EPEL & DVD Repos for Red Hat Enterprise Linux 6.2

After a fresh installation of RedHat Enterprise Linux 6.2, my repolist was blank:

# yum repolist
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
repolist: 0

Note: Make sure your server has access to the internet and that DNS is correctly configured (You can use Google's Public DNS 8.8.8.8).

Enable the EPEL repo using the following command:

#  rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.GOjvJB: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

Check again to see if the epel repo has been enabled successfully:

# yum repolist
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
epel/metalink                                                                                                                                                                                             | 1.5 kB     00:00     
epel                                                                                                                                                                                                      | 4.4 kB     00:00     
epel/primary_db                                                                                                                                                                                           | 6.2 MB     00:03     
repo id                                                                                   repo name                                                                                                                        status
epel                                                                                      Extra Packages for Enterprise Linux 6 - x86_64                                                                                   10,998
repolist: 10,998

I noted one issue, even when my repolist show that epel is enable, i can't use it to install packages for example FTP:

# yum install ftp
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
No package ftp available.
Error: Nothing to do

I checked the redhat.repo directory and realised it was empty even after adding the epel repo. so the repo won't work.

# cd /etc/yum.repos.d
# ls -ltr
total 16
-rw-r--r--. 1 root root  529 Nov  8  2011 rhel-source.repo
-rw-r--r--. 1 root root 1056 Nov  5  2012 epel-testing.repo
-rw-r--r--. 1 root root  957 Nov  5  2012 epel.repo
-rw-r--r--. 1 root root   78 Jul 15 19:21 redhat.repo

# more redhat.repo
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#

The solution is to open a Red Hat account on http://www.redhat.com/
Register your server using this command and your red hat account login and password:

# rhn_register

Yet another issue was, i did NOT have a valid product subscription for the RHEL 6.2 i installed!
Yet i badly needed to install some packages to get my server running; for example the ftp packages and other small packages.

Solution is that the installation media/DVD has these packages, so you can add a repo to point to your RHEL DVD. Nice :-), i managed to get this to work, continue reading:

Insert the DVD in the DVD-ROM and mount it:
#mkdir /media/redhat-dvd
# mount -t ext4 /dev/dvd /media/redhat-dvd

check to make sure the mounting was OK:
[root@airtelug yum.repos.d]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_airtelug-lv_root
                       50G  1.7G   46G   4% /
tmpfs                  12G     0   12G   0% /dev/shm
/dev/sda1             485M   37M  423M   9% /boot
/dev/mapper/vg_airtelug-lv_home
                      195G  188M  185G   1% /home
/dev/sr0              3.4G  3.4G     0 100% /media/redhat-dvd
[root@airtelug yum.repos.d]#

create a .repo file
#cd  /etc/yum.repos.d
# touch redhat-dvd.repo
[root@airtelug yum.repos.d]# ls -ltr
total 16
-rw-r--r--. 1 root root  529 Nov  8  2011 rhel-source.repo
-rw-r--r--. 1 root root 1056 Nov  5  2012 epel-testing.repo
-rw-r--r--. 1 root root  957 Nov  5  2012 epel.repo
-rw-r--r--. 1 root root   78 Jul 15 19:21 redhat.repo
-rw-r--r--. 1 root root    0 Jul 15 19:49 redhat-dvd.repo
[root@airtelug yum.repos.d]#

copy the contents of the rhel-source.repo into you new dvd repo file

#cat rhel-source.repo > redhat-dvd.repo

Edit the dvd repo file to make sure that the fields are consistent with your choices:
see mine here:

[root@airtelug yum.repos.d]# more redhat-dvd.repo
[redhat-dvd]
name=RHEL-$releasever - dvd
baseurl=file:///media/redhat-dvd
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@airtelug yum.repos.d]#

so use vi to edit your repo file accordingly

#vi redhat-dvd.repo

Run yum repolist to update the repositories:

# yum repolist

Your new DVD repo should appear in the list.
You can now use your new DVD repo to search for and install packages

# yum search ftp
# yum install ftp

Leave a comment if you are having any issues related to adding a DVD repo and i will be glad to help :-)



Post a Comment