Create a Yum Repository from CentOS 6 DVD

We already looked at Creating local yum repository on Linux. In this how to we will look into creating local yum repository from CentOS 6 DVD


Canada colocation

First lets download CentOS6 DVD to /usr/local/iso

#cd /usr/local/iso
#wget http://centos.mirror.vexxhost.com/6.7/isos/x86_64/CentOS-6.7-x86_64-bin-DVD1.iso

Now we will need to mount iso that we just downloaded to /mnt/cdrom

#mkdir -p /mnt/cdrom
#mount -o ro /usr/local/iso/CentOS-6.7-x86_64-bin-DVD1.iso /mnt/cdrom/
#cd /mnt/cdrom/
# ls
CentOS_BuildTag  isolinux                  RPM-GPG-KEY-CentOS-Debug-6
EFI              Packages                  RPM-GPG-KEY-CentOS-Security-6
EULA             RELEASE-NOTES-en-US.html  RPM-GPG-KEY-CentOS-Testing-6
GPL              repodata                  TRANS.TBL
images           RPM-GPG-KEY-CentOS-6

Lets create repository definition file and call it mydvd.repo

vi /etc/yum.repos.d/mydvd.repo

[mydvd]
name=dvd repo
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
      

Command yum -v repolist should now show our mydvd repository

#yum -v repolist

Repo-id      : mydvd
Repo-name    : dvd repo
Repo-revision: 1438724892
Repo-updated : Tue Aug  4 17:49:56 2015
Repo-pkgs    : 6,575
Repo-size    : 5.4 G
Repo-baseurl : file:///mnt/cdrom/
Repo-expire  : 21,600 second(s) (last: Fri Mar 11 13:16:30 2016)
Repo-filename: ///etc/yum.repos.d/mydvd.repo

We now can list packages available from this repository

yum --disablerepo="*" --enablerepo="mydvd" list available