How to Setup Local Yum Repository from CD-ROM/DVD-ROM image on Fedora 16

Share this Article :

In this post, i will share on how to install, update and remove RPM packages from CD-ROM/DVD-ROM image or local yum repository on linux Fedora 16 server. This will very useful when you are running on slow internet connection. Instead of go through the internet connection, it is possible to use local repository to install the module and package. Follow these steps to setup your local CD-ROM/DVD-ROM yum repository on linux Fedora 16 server.

1. Mount your DVD into /mnt or /media. It’s depend on you.

[[email protected] ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only

2. Enter to /mnt directory and list out the files :

[[email protected] ~]# cd /mnt
[[email protected] mnt]# ls
GPL       RPM-GPG-KEY-fedora               RPM-GPG-KEY-fedora-ppc    RPM-GPG-KEY-fedora-sparc64
images    RPM-GPG-KEY-fedora-16-primary    RPM-GPG-KEY-fedora-ppc64  RPM-GPG-KEY-fedora-x86_64
isolinux  RPM-GPG-KEY-fedora-16-secondary  RPM-GPG-KEY-fedora-s390   TRANS.TBL
Packages  RPM-GPG-KEY-fedora-arm           RPM-GPG-KEY-fedora-s390x
repodata  RPM-GPG-KEY-fedora-i386          RPM-GPG-KEY-fedora-sparc

3. Create files fedora16.repo under /etc/yum.repos.d and enter the following lines :

[[email protected] ~]# vi /etc/yum.repos.d/fedora16.repo

Enter these lines in fedora16.repo :

[Fedora16-Repository]
name=DVD-Fedora16 Repository
baseurl=file:///mnt
enabled=1
gpgcheck=0

Please proceed to step 4 – step 8 when you perform yum command to install the package or module and get the following error :

Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. 
Please verify its path and try again

4. Create repo.disabled inside /etc/yum.repos.d :

[[email protected] ~]# mkdir /etc/yum.repos.d/repo.disabled

[[email protected] ~]# ls /etc/yum.repos.d/
fedora16.repo fedora.repo  fedora-updates.repo  fedora-updates-testing.repo  repo.disabled

6. Then moved all these 3 repo files into “repo.disabled” folder :

[[email protected] ~]# mv /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/repo.disabled
[[email protected] ~]# mv /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/repo.disabled
[[email protected] ~]# mv /etc/yum.repos.d/fedora-updates-testing.repo /etc/yum.repos.d/repo.disabled

7. List out the updated files and folders inside /etc/yum.repos.d :

[[email protected] ~]# ls -l /etc/yum.repos.d/
total 8
-rw-r--r--. 1 root root   92 Mar 18 00:09 fedora16.repo
drwxr-xr-x. 2 root root 4096 Mar 18 01:27 repo.disabled

Note : Only file fedora16.repo and folder repo.disabled should be exist.

8. Run yum clean all to clear up your yum cache directory :

[[email protected] ~]# yum clean all
Cleaning repos: Fedora16-Repository
Cleaning up Everything

9. Steps completed. You can start using yum command as usual.

[[email protected] ~]# yum install module/package
[[email protected] ~]# yum update module/package
[[email protected] ~]# yum remove module/package

Leave a Reply