In this post, I will explain how to create your own local repository in Centos 7.
1.Attach and mount the iso
sudo su -
mkdir /mnt/cdrom #create a mount point
mount /dev/cdrom /mnt/cdrom
df -h #verify if mounted
2.Copy the Packages from iso
ISO comes with inbuilt packages.These packages must have .rpm extension. So, we copy those inbuilt packages to another directory and make it as a new repository.
ls /mnt/cdrom
cp -R /mnt/cdrom/Packages /root
3.Create .repo file in /etc/yum.repos.d directory
Create a configuration file with .repo as extension and add these details into it.
vi /etc/yum.repos.d/local.repo
Filename - local.repo
[localrepo]
name=Prajwal Repository
baseurl=file:///root/Packages
gpgcheck=0
enabled=1
In the above file(ie., local.repo),
'name' is the name of the repo,
'baseurl' is the path to the package directory
'gpgcheck' it takes 0 or 1. It's used for security. Only a user with gpgkey can access this repo if it's set to 1
'enabled' it also take 0 or 1. To activate this repo set it to 1.
4.Building local repository
createrepo is the command to create a repository.
yum info createrepo
yum install createrepo
createrepo -v /root/Packages
5.Verify if the repository is successfully created.
yum repolist all | grep -i prajwal
Cool then!
Top comments (1)
I like the ISO install instructions! This is super handy for air-gapped environments!