CentOS DVD local repo creation

yum install createrepo

mkdir /mnt/dvd1 && mkdir /mnt/dvd2 && mkdir /opt/repo && mkdir /opt/iso
mount -o loop /opt/iso/CentOS-6.6-x86_64-bin-DVD1.iso /mnt/dvd1/ && mount -o loop /opt/iso/CentOS-6.6-x86_64-bin-DVD2.iso /mnt/dvd2/

rsync -arv /mnt/dvd1/ /opt/repo/
rsync -arv /mnt/dvd2/ /opt/repo/

createrepo -c cache -s sha –update –groupfile `ls /opt/repo/repodata/*comps*.xml` /opt/repo

cat <<EOT > /etc/yum.repos.d/local.repo
[local-repo]
name=CentOS 6.6 local repository
baseurl=file:///opt/repo/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
EOT

Leave a comment

You must be logged in to post a comment.