1) Attach .iso image in Virtual manager (if you are running in virtual machine in your base machine) OR insert iso image cd (if your linux os running in base machine)
2) Mount iso image as follows
mount /dev/sr0 /media/
3) Create one folder to copy all packages
mkdir /repo
I have created repo directory in root (/)
4) copy all packages from /media/Packages (we have recently mounted in /media)
cp -rv /media/Packages/* /repo
5) for yum server, you need to install createrepo packages using rpm. install createrepo package using rpm which is located in /repo.
(go to /repo and install following packages ie cd /repo)
rpm -ivh createrepo*
while installing createrepo package using rpm it will ask for failed dependancies. install those dependancies first
rpm -ivh python-deltarpm-3.6-3.el7.x86_64
rpm -ivh deltarpm-3.6-3.el7.x86_64
now you will be able to install createrepo package. go ahead and install it
rpm -ivh createrepo*
6) Once you installed createrepo, fire following command to create metadata file
createrepo /repo
it will take some, have patience
7) Now go to yum configuration file [Before any changes made to configuration file make sure that you have took backup of it somewhere]
cd /etc/yum.repos.d/
check all files here. you will be having one .repo file. edit the following line
name=MyLocalRepo
baseurl=file:///repo
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Explanation:
first line: Name of yum repo. any name you can mention here
baseurl: location of repo directory from where it will take packages. as we created for local repo, we are mentioning as file.
enabled, means repo it active and enabled
gpgcheck, this often used to check key with server, hence we have created local repo so better to make its value as zero or comment the both gpgcheck line
Yeap, we have sucessfully configured local yum repo. now you can install, update or remove package using yum repo.