How to stop automatic upgrade on Ubuntu

update

When using Ubuntu, automatic upgrade may be set by default. In that case, the server may be restarted automatically at the time of upgrade.
It is better to stop this setting on a server that should not be stopped, such as for websites.
Therefore, this knowledge describes the procedure to stop the automatic upgrade of Linux OS.

Sponsored Links

How to stop automatic upgrade on Ubuntu

The procedure to stop the automatic OS upgrade is described below.

  • If necessary, update the software before stopping the automatic upgrade.
$ sudo apt-get update
$ sudo apt-get upgrade
  • A text editor may not be installed depending on the OS. If necessary, install a text editor to change the settings.
$ sudo apt-get install vim
$ sudo apt-get install emacs
  • Check the current automatic upgrade settings.
    • “APT::Periodic::Update-Package-Lists”: Automatic update settings
      • 1: Valid, 0: Invalid
    • “APT::Periodic::Unattended-Upgrade”: Automatic upgrade settings
      • 1: Valid, 0: Invalid
    • “APT::Periodic::Download-Upgradeable-Packages”: Automatic upgrade settings – Package download only
      • 1: Valid, 0: Invalid
$ cat /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
  • Turn off the automatic upgrade setting.
    • Change the setting value of “APT::Periodic::Unattended-Upgrade” to 0 and save.
$ sudo vi /etc/apt/apt.conf.d/20auto-upgrades

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "0";
  • Confirm that the settings have been changed.
$ cat /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "0";
Sponsored Links