Centos repository server auto update

centosredhatrepositoryyum

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 🙂

Best Answer

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

Related Topic