OSETC TECH

CentOS /Linux: How To Confiure YUM Source Repository

YUM Tools must be your first choice to install the software package under CentOS or RHEL Linux operating system.  So you should know that how to setup or configure Yum source repository on CentOS system or other Linux system.  This post will show you how to set up a CentOS Yum repository , also you’ll see how to add your own software list into the previous or current Yum source repository .

​CentOS Setup Yum Source Repository Using CDROM

Step1#  you should buy a CentOS OS DVD disk or burn one by yourself and then insert it into CDROM. of course, if you want to read content from CDROM,  you have to mount CDROM to a directory such as: /media. issue the following command:

$sudo mount /dev/cdrom /media

Step2# create a Yum configuration file named as “softtest.repo” under “/etc/yum.repos.d/ and make sure that the extention of file is “.repo“. then edit that file using “vim” command:

$sudo vim /etc/yum.repos.d/softtest.repo

Adding the below content into “softtest.repo” file:

[base]

name=Server
baseurl=file:///media
gpgcheck=0
enabled=1

Save and exit that file .using the following command to clean yum cache:

$sudo yum clean all

Outputs:

[devops@osetc] $ sudo yum clean all

Loaded plugins: fastestmirror, refresh-packagekit, security

Cleaning repos:

Cleaning up Everything

Now you can use yum command to install sofeware package.

CentOS Updating Yum Repository List

If  you just want to update software package list in the current Yum repository, how to do this? it need to update the repomd.xml file under yum repository. How to update this file ? there is a tool named as createrepo, use it to update repomd.xml file.  refer to the below steps:

Step1# download and install createrepo tool, type:

 $sudo yum -y install libxml2-python

 $sudo wget ftp://195.220.108.108/linux/dag/redhat/el4/en/i386/dag/RPMS/createrepo-0.4.6-1.el4.rf.noarch.rpm

$sudo rpm -ivh createrepo-0.4.6-1.el4.rf.noarch.rpm

OR

$sudo yum -y install createrepo

Step2# update repomd.xml file using createrepo command, type:

$sudo createrepo /mnt/Packages

Step3# Clean up yum cache, type:

$sudo yum clean all

Done…