Using DVD as a yum repository

So, you’ve just gotten a fresh installed Linux system with Oracle Linux or Redhat Linux from the sysadmin. And with Oracle Linux you can not use the internet (forbidden by company laws is a common one), or you got Redhat Linux and can not use up2date for some reason. Most of the time, when installing Oracle products I am allowed to use the root account myself during the install. The DVD most of the time is still present in the drive.

You could mount the DVD and use ‘rpm’ directly to install packages off the DVD. If you get an error the rpm package has a dependency, you resolve the dependency, if that depended package has a dependency itself, you resolve that, etc. That’s something you could do. But there is an easier way!

Mounting the DVD

The first task is to mount the DVD again. The installation procedure does not add an entry in /etc/fstab to mount the DVD in an easy way, so I do that myself. The installer makes a generic device in /dev for the DVD, /dev/dvd, which is a symbolic link to the device that truly is the DVD drive. This is how the line for /etc/fstab looks like:

1/dev/dvd                /media                  udf,iso9660 noauto,user,ro              0 0

First column is the device, second column is the directory the device get mounted to, the third column are the filesystem types, the fourth column are the mount options (noauto: the DVD does not get mounted automatically, it needs to be mounted explicitly, user: a regular user is allowed to mount the device, ro: readonly).
Next we need to mount the dvd using the command:

1mount /media

It will briefly wait before returning the cursor, during which it mounts the DVD to the /media directory, and can be checked by looking at all the mounts:

# mount
/dev/mapper/vg00-lvroot on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/cciss/c0d0p1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sr0 on /media type iso9660 (ro,noexec,nosuid,nodev)

Setup the repository information

Okay, now that we have the DVD mounted, let’s create a DVD based yum repository. The repositories are listed in the directory /etc/yum.repos.d. Repositories can be grouped in files. A default installed system lists a few repositories:

1
2
# ls /etc/yum.repos.dredhat.repo 
rhel-debuginfo.repo  rhel-source.repo

Redhat.repo does not contain any repository (the remarks in the file suggest that a subscription manager probably will use this file), rhel-debuginfo.repo has two repositories in it with the debug-info packages (binaries with the debugging information in the binary, so you have all the debug information to get full information with for example gdb; normal binaries are ‘stripped’), rhel-source.repo contains a repository with all the source rpm’s in it. All these repositories are disabled (enabled=0).

To get yum use the DVD as a repository, add a file ‘rhel-dvd.repo’ in /etc/yum.repos.d with the following content:

1
2
3
4
[dvd]
name=Red Hat Enterprise Linux Installation DVD
baseurl=file:///media/Server
enabled=0

The added repository is named ‘dvd’, and is disabled. In order to use this repository, add ‘–enablerepo=dvd’ to use it. This way it doesn’t interfere with anything, like someone adding a web-based (“real”) repository.

Using the repository

Now you can add packages, which dependencies are resolved by yum using:

1# yum install --enablerepo=dvd packagename

just like when yum is setup with a “real” web-based repository.

Another extremely handy feature of yum is searching for a specific file in the repository. For example, if you want to send files as attachment on linux, one way of attaching files is using the ‘uuencode’ executable to generate a file as mail attachment. ‘uuencode’ is not installed by default, nor a package with that name exists. To search in the yum repository for a file called ‘uuencode’, enter the following:

1
2
3
4
5
6
7
# yum provides --enablerepo=dvd */uuencode
Loaded plugins: product-id, security, subscription-manager
Updating Red Hat repositories.
sharutils-4.6.1-2.x86_64 : The GNU shar utilities for packaging and unpackaging shell archives.
Repo        : dvd
Matched from:
Filename    : /usr/bin/uuencode

This shows the package ‘sharutils’ contains a file ‘/usr/bin/uuencode’.

Similar Posts

  • How to mount Windows share on Red Hat Enterprise Linux system using CIFS?

    Solution Verified – Updated April 4 2022 at 8:28 PM – Environment Red Hat Enterprise Linux 8 Red Hat Enterprise Linux 7 Red Hat Enterprise Linux 6 Red Hat Enterprise Linux 5 Issue How can Windows shares be mounted on Red Hat Enterprise Linux? Resolution To run the following commands, you need to install cifs-utils…

  • RHEL 6 NFS

    Ensuring NFS Services are running on RHEL 6 The first task is to verify that the NFS services are installed and running on your RHEL 6 system. This can be achieved either from the command line, or using the graphical services tool. Begin by confirming that the NFS service is installed by running the following command from a…

  • Mount NTFS on RHEL

    ElRepo repository has kmod-fuse package that does not need dkms system. Since kmod installation uses module aliases (something like symlinks on filesystems), it works on all installed and future kernels without the need to recompile/install even automatic one with dkms. Get started Import the public key:rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org Detailed info on the GPG key used by the…

  • RHEL 6 Install Info

    Bios Settings on HPZ420 Enter BIOS and change the following settings: Storage                 Storage options                                 SATA Mode ==> IDE                 Boot Order                                 UEFI Boot Sources ==> Disable All                                 Legacy Boot Sources ==> Enable All Installing RHEL 6.3 Prerequisites You will need: The RHEL 6.3 Installation DVD and license from RedHat (you need the Workstation…

  • RHEL 6 Samba

    Samba and Samba Client Samba allows both RHEL resources to be shared with Windows systems and Windows resources to be shared with RHEL systems. RHEL accesses Windows resources using a package named samba-client. RHEL resources, on the other hand, are shared with Windows systems using a package named samba. Typically, the samba-client is installed and…