- copy the ISO file from DVD or other centos server by using SCP
#scp ISOfile (source file) 192.168.x.x(destination ip):/opt/package/(destination folder)
Eg:
#scp Centos-7_DVD.iso 192.168.x.x:/opt/isofile
- mount the iso file to directory
#mount –o loop isofile /dir
Eg:
#mount –o loop Centos-7_DVD.iso /mnt
- Create one new directory in “opt” directory to copy the rpm packages
#cd /opt
#mkdir /package
#cp /mnt/package/*.* /opt/package/
- Create repo in the directory /opt/package
# createrepo –v .
- Create local repo file in /etc/yum.repo.d/ directory
#cd /etc/yum.repo.d/
#vi local.repo
- Add the lines in that local.repo file
Eg:
[local]
name=local
baseurl=file:///opt/package
enabled=1
gpgcheck=0
name: user understandable name for localrepo
baseurl: path of local repo file directory
enabled: 0 means disabled and 1 means enabled
- Unmount the /mnt directory from system
#umount /mnt
- Enable the repo
#yum-config-manager –enable local
- Clean the cache and check the repo is enabled or not
#yum clean all
#yum repolist all