I have repository server running on Centos7.4 and all the centos clients in my network do yum update through repo server.
The question when there is an updates, do I need to download manually to Server or is there any tool that able to check new updates from repo mirror sites and automatically push down to the repo server's designated folder?
Thank you :)
2 Answers
If you already have a local network repository mirror working, then you should configure the clients to use it, and they will update from there.
In your clients:
cd /etc/yum.repos.d
vim mylocal.repo
Fill in:
[mylocalrepo]
name=Local CentOS Repository
baseurl=http://my-repo-server/CentOS/7/4
gpgcheck=0
Where my-repo-server
is the URL or IP of your repo server.
You should probably remove/comment the official public repos URL from the clients as well if you don`t want them updating through the Internet.
Forgot the auto-update part:
For the auto-update / auto-upgrade to work you should do a few more changes in the clients.
Install yum-cron
sudo yum install yum-cron
Configure yum-cron
sudo vim /etc/yum/yum-cron.conf
You can select which packages to auto-upgrade in yum-cron among other self-documented options in that file, this are the upgrade options to choose from:
# default = yum upgrade
# security = yum --security upgrade
# security-severity:Critical = yum --sec-severity=Critical upgrade
# minimal = yum --bugfix upgrade-minimal
# minimal-security = yum --security upgrade-minimal
# minimal-security-severity:Critical = --sec-severity=Critical upgrade-minimal
I would probably not recommend leaving the default
, and instead use the security
one. As upgrading all the packages automatically could lead to unforeseen issues.
Start and enable the service for auto start on boot:
sudo systemctl start yum-cron
sudo systemctl enable yum-cron
ps. Upgrade and update are two different things. The first one executes the package upgrades, while the latter just updates the repository index (to see which changes are upstream).
-
Thank you Leo.. Can I configure a cron job for local netwrok repo server which will always check new updates on RedHat repo sites through internet and automatically push down to the server's local repo folder if there is an update. Otherwise, the server's repo data won't be the updated. Is there any way to perform this job?– David AMay 15, 2018 at 12:26
CentOS repo have very simple structure, so you can update a local mirror of it using simple rsync
command in your local repo server, something like this:
rsync -vaSH rsync://mirror.facebook.net/centos/ /your/mirror/directory/
You may want to skip downloading the ISOs, in which case you exclude those in your rsync:
rsync --exclude isos --exclude '*.iso' -vaSH rsync://mirror.facebook.net/centos/ /your/mirror/directory/
Make sure you have those /
at the end of the URL and path, as rsync
may work differently without it.
Replace rsync://mirror.facebook.net/centos/
with the mirror of your choice. You can see the list of public mirror here.
You can simply have this command in your cron jobs - e.g. create a file under /etc/cron.daily
with this command - then your local repo will be updated routinely.