In this guide, we will set up a local YUM repository using a DVD or a DVD ISO. This guide was tested on Linux 6 but it should also work on other Linux versions.
Here’s a couple of useful applications for having a local YUM repo especially when your server cannot access the internet:
– Update your server to the latest Linux Version.
– Install any RPMs and let YUM automatically resolves all the dependencies from the DVD for you.
Step 1 – Mount the DVD or the ISO.
Run all the commands as root or sudo.
Create the mount point for the DVD/ISO.
# mkdir -p /mnt/dvd
For DVD, use lsscsi command and grep for dvd to find your DVD. It is /dev/sr0 in the example below.
# lsscsi | grep dvd
[6:0:0:0] cd/dvd hp DVDROM DT50N D700 /dev/sr0
Mount the DVD.
# mount /dev/sr0 /mnt/dvd
mount: block device /dev/sr0 is write-protected, mounting read-only
If you are using a Linux ISO, then mount the ISO instead of the DVD.
Replace the ISO below with the name of you Linux ISO.
# mount -o loop /software/oracleLinux-server-x86_64-dvd.iso /mnt/dvd
Step 2 – Rename any unused .repo files so they don’t interfere with your YUM setup.
My Oracle Linux 6 installation comes with the default public-yum-ol6.repo. I renamed it to public-yum-ol6.repo.orig so it doesn’t try to access that repo.
# mv /etc/yum.repos.d/public-yum-ol6.repo /etc/yum.repos.d/public-yum-ol6.repo.orig
Step 3 – Create a .repo file in /etc/yum.repos.d directory. I named my file oel64.repo.
/etc/yum.repos.d/oel64.repo:>
[OEL64repo]
name=OEL64DVD
baseurl=file:///mnt/dvd
gpgcheck=0
enabled=1
sslverify=false
Step 4 – Verify yum is working.
# yum list|grep http
httpd.x86_64 2.2.15-26.0.1.el6 @OEL64repo
httpd-manual.noarch 2.2.15-26.0.1.el6 @OEL64repo
httpd-tools.x86_64 2.2.15-26.0.1.el6 @OEL64repo
httpd-devel.i686 2.2.15-26.0.1.el6 OEL64repo
httpd-devel.x86_64 2.2.15-26.0.1.el6 OEL64repo
jakarta-commons-httpclient.x86_64 1:3.1-0.6.el6 OEL61repo