How to Set Up Local Yum Repository Centos 7

How to Set Up Local Yum Repository Centos 7
How to Set Up Local Yum Repository Centos 7

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 -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 






Closing statement

In conclusion, setting up a local Yum repository in CentOS 7 offers a practical solution for managing system updates efficiently, especially in environments with multiple Linux servers. By creating a local repository, administrators can mitigate internet bandwidth concerns while ensuring timely updates for their systems. 

Through the steps outlined in this guide, including preparation, installation, and configuration, users can establish a reliable update mechanism tailored to their specific needs. Embracing this approach empowers administrators with greater control over update distribution, enhancing the stability and security of their CentOS 7 infrastructure. 

We trust that this article provides valuable insights into streamlining system update processes and optimizing network resources in CentOS 7 environments.

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

Thank You 

Bangkit Ade Saputra
Bangkit Ade Saputra At the end of the day, my job involves people. we're complicated, we're always changing, we have millions of things going on in our lives, and changing jobs is always a big decision.

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