How to Enable Automatic Updates on your Linux Server

linux server

As you’re looking to find out how to enable automatic updates on your Linux Server, you have come to the right place and we will walk you through it.

Linux servers are known to be the most secure and reliable all around the world, this is due to the fact that it is open source and absolutely free to use with robust support.

While they are the most secure, you can’t always rely on the same security and performance protocols of two months ago to manage the changes in the space of technology and security.

It is important to always get updates as they come, most importantly as it will allow your servers to get access to new technology and features, and give you new security features as they are released.

Before we go ahead, we’ll like to take the stress of managing your servers off you by letting you know about our Managed Servers offering especially if you are having a website with lots of traffic.

Enabling Automatic Updates for CentOS

1. Connect to your server as root via SSH

2. Run the following command to install the yum-cron package using the YUM package manager. This package is used for enabling the automatic updates feature.

# yum install yum-cron -y

3. Edit the default configuration file /etc/yum/yum-cron.conf using your favorite text editor

update_cmd = default

apply_updates = yes

4. Once you have entered those, go ahead and save the configuration file.

5. Restart the yum-cron service on your server.

# systemctl restart yum-cron

6. Enable yum-cron service on system boot.

# systemctl enable yum-cron

You have now successfully enabled automatic server updates on your Cent OS

Enabling Automatic Updates for Ubuntu

1. Connect to your server as root via SSH.

2. Run the following command to install the unattended-upgrades package using apt package manager. This is responsible for enabling the automatic updates feature.

# apt-get install unattended-upgrades

3. Edit the default configuration file /etc/apt/apt.conf.d/50unattended-upgrades using your favorite text editor

Unattended-Upgrade::Allowed-Origins {

“Ubuntu xenial-security”;

//      “Ubuntu xenial-updates”;

};

4. The following services should be added to the blacklist to prevent them from automatic updates.

Unattended-Upgrade::Package-Blacklist {

“vim”;

“libc6”;

};

5. Edit the /etc/apt/apt.conf.d/10periodic file on your server using your favorite text editor to enable automatic updates.

APT::Periodic::Update-Package-Lists “1”;

APT::Periodic::Download-Upgradeable-Packages “1”;

APT::Periodic::AutocleanInterval “7”;

APT::Periodic::Unattended-Upgrade “1”;

Yaay! You just did it, Automatic updates are now enabled on your Linux server!

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top