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

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.

[root@fedora16 ~]# 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 :

[root@fedora16 ~]# cd /mnt
[root@fedora16 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 :

[root@fedora16 ~]# vi /etc/yum.repos.d/fedora16.repo

Enter these lines in fedora16.repo :

name=DVD-Fedora16 Repository

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 :

[root@fedora16 ~]# mkdir /etc/yum.repos.d/repo.disabled

[root@fedora16 ~]# 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 :

[root@fedora16 ~]# mv /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/repo.disabled
[root@fedora16 ~]# mv /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/repo.disabled
[root@fedora16 ~]# 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 :

[root@fedora16 ~]# 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 :

[root@fedora16 ~]# yum clean all
Cleaning repos: Fedora16-Repository
Cleaning up Everything

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

[root@fedora16 ~]# yum install module/package
[root@fedora16 ~]# yum update module/package
[root@fedora16 ~]# yum remove module/package


Leave a Reply

Your email address will not be published. Required fields are marked *