Installing RPM's on RedHat Enterprise Linux 5

In a "professional" environment, when you are using a GNU/Linux distribution, it's quite often RedHat Enterprise Linux.

So I was trying some stuff at work with a RHEL5. But after being installed, you need an account to the RedHat Network in order to keep your RHEL updated and install new packages.

Of course, an account on RHN is not really free. I wanted to install some softwares that were included on RHEL5 DVD but the UI for installing/removing softwares is really crappy and does not allow to change/specify RPM repositories/locations.

One way to install a RPM is using the rpm command, but when the package has a lot of dependencies, it's nearly impossible to manage it by hand.

Yum is the tool used for updating the system and installing new softwares and it's able to manage the dependencies between packages.

Creating a local repository for yum

Here is a way to create a repository (in /srv/repo) with the RPMs located on RHEL5 DVD and add it to yum.

  • Install createrepo. It's a single RPM which can be easily installed manually:

    # cd /<path_to_dvd_1>/Server
    # rpm -i createrepo*.rpm
    
  • Copy RPMs into a repository directory:

    # mkdir /srv/repo
    # cp /<path_to_dvd_1>/Server/*.rpm /srv/repo # this command may not work 'as is' if there are too many files to copy
    # cp /<path_to_dvd_2>Supplementary/*.rpm /srv/repo
    
  • Create the repository:

    # createrepo /srv/repo
    
  • Create the file /etc/yum.repos.d/local.repo:

    [localrepo]
    name=Red Hat Enterprise Linux Local Repository
    baseurl=file:///srv/repo
    enabled=1
    gpgchekc=0
    
  • Now you will be able to install with it dependencies any of the RPMs located in your repository by typing:

    # yum install <name_of_the_package>
    

If you add some more RPMs in your repository, you need to execute again the createrepo command.

EPEL

EPEL (Extra Packages for Enterprise Linux) is a repository of extra packages maintained by the community. It may contains some useful applications and adding it to yum is very easy:

# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

Some thoughts

RHEL is targeting companies ready to put money into their Linux distributions, so they manage to get money by selling support and updates on their software.

But when you want to use RHEL and you don't want to have to create an account on RHN and pay for it, you mostly can't update your system. So you quickly have an operating system out of date with unpatched security holes. Anyway, I hope only few people like me try to use RHEL without a subscription.

An alternative is to use CentOS, which is mostly the same as RHEL but closer to the open source mindset.

Anyway, good people use Debian 😉.

Comments Add one by sending me an email.