Skip to content Skip to sidebar Skip to footer

How to Set Up Local Yum Repository Centos 7

Anyone who operates many Linux servers in their environment is also faced with the problem of system updates from time to time. Now everyone can carry out the updates during the night, but this does not avoid the problem of traffic on their Internet line. 

Similar to WSUS at Microsoft, Linux offers the option of running its own repo server. Updates, addons or extras are automatically downloaded at the selected time and stored locally on the server. The admin is responsible for the distribution or polling interval of the updates.


The basic requirement is a running web server on our system. There we create the following directories:

# mkdir -p /var/www/html/centos/7/os/i386
# mkdir -p /var/www/html/centos/7/updates/i386

The path must of course be adjusted for the 64-bit community. :-)


Next we create the reference of our distribution with:

# createrepo /var/www/html/centos/7/os/i386/

The createrepo package must be installed for this.

# yum install createrepo



Finally, we create a cron job which downloads the packages at the selected times:

/usr/bin/rsync -avrt rsync:// –exclude=debug/ /var/www/html/centos/7/updates/| /bin/mail [email protected] -s "New updates available"

So that we can also find out that new packages are available, we let ourselves be informed by e-mail.


On our clients we edit the CentOS-Base.repo:

# vi /etc/yum.repos.d/CentOS-Base.repo


name=CentOS-$releasever - Base






#released updates 


name=CentOS-$releasever - Updates 






Maybe that's all I can share with you guys, hopefully this article will be useful.

Thank You 

Bangkit Ade Saputra
Bangkit Ade Saputra Hard-working professional with experience and a proven knowledge of operating system, server architecture and system configuration.

Post a Comment for "How to Set Up Local Yum Repository Centos 7"