How to create local yum repository in Centos
The Yellowdog Updater Modified (YUM) is an rpm package management opensource tool which is available for Redhat Linux and other Linux flavors.In earlier days, its very difficult to install packages in Linux systems since it will ask for many dependencies.After yum introduction,its become very simple and yum has algorithm to select all the dependencies automatically once you configured the yum repository.
This tutorial explains the steps to configure local yum repository.
Step1: Create the source folder.
#mkdir /cdrom
Step2: Copy the packges and dependencies to this folder
Step3: Change the location to the source folder
#cd /data
Step4: Confugre metadata
#createrepo .
Step5: Change the location to repo config folder.
#cd /etc/repos.d
Step6: Create Repo file
#vi /etc/yum.repos.d/local.repo
Step7: Add the following details.
[LocalRepo]
name=LocalRepository
baseurl=file:///data
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Where,
[LocalRepo] – Name of the Section.
name = Name of the repository
baseurl = Location of the package
Enabled = Enable repository
gpgcheck= Enable secure installation
gpgkey = Location of the key
gpgcheck is optional (If you set gpgcheck=0, there is no need to mention gpgkey)
That's all... Now we can install or upgrade packages using yum command.