Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Using your DVD as a yum repository on a RPM based

Linux
So, youve 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. Thats 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:

/dev/dvd
noauto,user,ro

/media
0 0

udf,iso9660

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:

mount /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, lets 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.d
redhat.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 rpms 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 doesnt 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:

# 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 shel
archives.
Repo
: dvd
Matched from:
Filename
: /usr/bin/uuencode

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

You might also like