Why?


Search This Blog

Sunday, May 10, 2015

Centos 7 create local repo

Centos 7 create local repo

This is under wmware workstation 11. I setup cdrom's under wmware and use the dvd iso's. these now appear as sr0, sr1, and sr2. I create separate directory's under / and them mount each

# mkdir /cdrom
# mkdir /cdrom1
# mkdir /cdrom2
# mount /dev/sr0 /cdrom
# mount /dev/sr1 /cdrom1
# mount /dev/sr2 /cdrom2

I can now test each by using ls

# ls /cdrom
# ls /cdrom1
# ls /cdrom2

Add these to /etc/fstab for automount on boot

# vi /etc/fstab
/dev/sr0        /cdrom             iso9660       defaults        0   0
/dev/sr1        /cdrom1            iso9660       defaults        0   0
/dev/sr2        /cdrom2            iso9660       defaults        0   0

Now create the configuration file to define the local repo's

First one

# vi /etc/yum.repos.d/local.repo
[LocalRepo]
name=Local Repository
baseurl=file:///cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


Second one

# vi /etc/yum.repos.d/local1.repo
[Local1Repo]
name=Local Repository
baseurl=file:///cdrom1
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


Third one

# vi /etc/yum.repos.d/local2.repo
[Local2Repo]
name=Local Repository
baseurl=file:///cdrom2
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


Now lets clean things up and see what we have

# yum clean all
# yum repolist all

No comments:

Post a Comment