== How to install RPM packages from the DVD ==

This is why I hate RPM so much... Anyway...

One day a user comes to you and says: "I want Ruby on this machine!". Why Ruby? Why not? Who cares?

Of course, this is a virtual machine, without a Red Hat license or access to the Internet, so no {{{yum install}}} for you. The only way to do this is to mount the Red Hat DVD on the machine and use that to install packages.

Here is how to do it with a minimum of fuss...

==== 1. Import GPG keys into the local RPM configuration ====

First, mount the DVD as root:

{{{ # mount -v -t iso9660 /dev/cdrom /mnt }}}

Next, import all the GPG keys that are on the DVD into the RPM configuration:

{{{ # rpm --import /mnt/RPM-GPG-KEY-redhat-release # rpm --import /mnt/RPM-GPG-KEY-redhat-beta }}}

Please note that these are all the keys I have on my DVD -- you may have more.

==== 2. Configure the DVD repo for yum =====

Now, create in the directory {{{/etc/yum.repos.d}}} a file named named {{{redhat.repo}}} that contains the following:

{{{ [dvd] name=RHEL 6.5 DVD baseurl=file:///mnt/Server/ enabled=0 }}}

Please note that the {{{baseurl}}} should point to the directory where you mounted the DVD image. If it is not mounted in {{{/mnt/}}}, change this to reflect your actual mount point.

Now, on to the easy part...:

==== 3. Use yum to install whatever it is you need: ====

The only little trick here is to enable the repository at the same time we install packages:

{{{ # yum install --enablerepo=dvd ruby ruby-* }}}

Why enable the repo every time? Because this way, whenever you enable another repository, {{{yum}}} won't look at the DVD to install packages... Cleaner configuration!

And... Everything should work!

Hope this helps!

== See Also: ==

Thanks to the sites linked above for the solution I present here!