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.
![]() |
How to Set Up Local Yum Repository Centos 7 |
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.
Preparation
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. :-)
Installing
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
Configure
Master
Finally, we create a cron job which downloads the packages at the selected times:
/usr/bin/rsync -avrt rsync://ftp.riken.jp/centos/7/updates/i386 –exclude=debug/ /var/www/html/centos/7/updates/| /bin/mail admin@localdomain.de -s "New updates available"
So that we can also find out that new packages are available, we let ourselves be informed by e-mail.
Client
On our clients we edit the CentOS-Base.repo:
# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=http://192.168.*.*/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
#released updates
[update]
name=CentOS-$releasever - Updates
baseurl=http://192.168.*.*/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
Maybe that's all I can share with you guys, hopefully this article will be useful.
Thank You
Post a Comment for "How to Set Up Local Yum Repository Centos 7"