How to set up automatic updates on Ubuntu Server 20.04, 22.04 or 24.04

Last updated on May 27, 2024

This guide explains how to configure automatic updates in Ubuntu Server 20.04 “Focal Fossa”, Ubuntu Server 22.04 “Jammy Jellyfish” or Ubuntu Server 24.04 “Noble Numbat”.

Step 1: package installation

Install the unattended-upgrades package:
sudo apt install unattended-upgrades

This package may already be installed on your server.

Step 2: configure automatic updates

Edit the configuration file (here with nano – replace with any other text editor):
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

The beginning of the configuration file should look like this:

Anything after a double slash “//” is a comment and has no effect. To “enable” a line, remove the double slash at the beginning of the line (replace with nothing or with spaces to keep alignment).

The most important: uncomment the “updates” line by deleting the two slashes at the beginning of it:
"${distro_id}:${distro_codename}-updates";

Recommended: remove unused kernel packages and dependencies and make sure the system automatically reboots if needed by uncommenting and adapting the following lines:
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
Unattended-Upgrade::Remove-New-Unused-Dependencies "true";
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "02:38";

To save your changes in nano, use Ctrl + O followed by Enter. To quit, use Ctrl + X.

How to get email notification after automatic updates

Uncomment and adapt the following lines to ensure you’ll be notified if an error happens:

Unattended-Upgrade::Mail "user@example.com";
Unattended-Upgrade::MailReport "only-on-error";

Please note: your server needs to be able to send emails – which is mostly not the case by default! If you didn’t install and configure Postfix on your server, email notifications will NOT work.

Step 3: enable automatic updates

Enable automatic updates and set up update intervals by running:
sudo nano /etc/apt/apt.conf.d/20auto-upgrades

In Ubuntu 22.04 and 24.04, the file has only the following two lines by default:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

Insert the following lines at the end of the file:

APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";

The time interval is specified in days, feel free to change the values. In total, you should have all four lines. Save changes and exit.

Step 4: check if it works

You can see if the auto-upgrades work by launching a dry run:
sudo unattended-upgrades --dry-run --debug

The dry-run may output something like this:

Unattended upgrades on Ubuntu Server 18.04 Bionic Beaver

Depending on your server configuration, the output may look less clean, which is OK:

Run automatic upgrades on Linux

Another way to check if automatic updates work is waiting a few days and checking the unattended upgrades logs:
cat /var/log/unattended-upgrades/unattended-upgrades.log

Done! Ubuntu Server 20.04 / 22.04 / 24.04 should now update itself once a day.

By Johannes Eva, April 2018 – May 2024

Articles by categories

Most Read Articles

Comments

15 thoughts on “How to install LibreOffice 24.2 on Linux Mint, Ubuntu, MX Linux, Debian…”

  1. You may use the official appimage in Libre Office as well. In fact, on Linux Mint 21 you can’t get rid of the default LO as it may lead to dependency issues. Appimage helps.

  2. Pingback: Ubuntu 21.04: Essentials – Linux Sagas

  3. Issuing $ sudo apt-get remove libreoffice-core installs an office core no gui. With or without purging. Yielding this:
    The following packages will be REMOVED:
    libreoffice-base libreoffice-calc libreoffice-core libreoffice-draw libreoffice-gnome libreoffice-gtk3 libreoffice-impress libreoffice-lightproof-ru-ru libreoffice-math libreoffice-nlpsolver libreoffice-report-builder libreoffice-report-builder-bin libreoffice-script-provider-python libreoffice-sdbc-postgresql libreoffice-wiki-publisher python3-uno
    The following NEW packages will be installed:
    libreoffice-core-nogui

    Many thanks for any clarification!

    1. Right! The correct command for removing completely the stock LibreOffice on Linux is the following:
      sudo apt purge libreoffice-common

      The following command also works but misses some packages:
      sudo apt purge libreoffice*

      Thank you for your comment, I updated the article accordingly.

  4. NOTE:- I found that Libre Office version 6.3.2.2 is extremely buggy, it has major dependency problems attempting to install on Linux Mint (Tina 19.2). I wasn’t able to resolve these problems so had to revert the install (remove 6.3.2.2-2) and return to previous version 6.3.1 which works fine.

    **Windows 10 (1903) ALSO NOTE that LO 6.3.2.2 installs on W10 but also caused major performance issues and hung my system on reboot. My machine Borked badly so once again had to revert back to LO 6.3.1 which works fine.

  5. Thanks for the Terminal codes. Newbies like me just want it to work and your codes provide the copy and paste necessities for Linux to do its magic.

    (If it can’t be done in Linux (and LibreOffice) its not worth doing)

  6. please help me with this error, newbee here

    root@Anon:~/libreoffice# sudo dpkg -i *.deb
    dpkg: error: dpkg status database is locked by another process
    root@Anon:~/libreoffice# cd LibreOffice_6.0.2.1_Linux_x86_deb
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb# sudo dpkg -i *.deb
    dpkg: error: dpkg status database is locked by another process
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb# cd debs
    bash: cd: debs: No such file or directory
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb# cd DEBS
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb/DEBS# sudo dpkg -i *.deb
    dpkg: error: dpkg status database is locked by another process
    root@Anon:~/libreoffice/LibreOffice_6.0.2.1_Linux_x86_deb/DEBS# sudo dpkg -i *.deb
    dpkg: error: dpkg status database is locked by another process

    1. The last line says it all: check if you are running another instance of dpkg. In last resort, try to remove dpkg lock file:

      sudo rm /var/lib/dpkg/lock

      Then let dpkg fix itself:
      sudo dpkg --configure -a

      Note that this problem is not per se related to LibreOffice.

  7. Would be useful to know how to install such alongside the native repository install of LibreOffice – without conflict. Would be useful to be able to choose, say, LibreOffice Writer 5.2, vs just LibreOffice Writer. Migrations / new versions not always working as seamlessly as one might like with files one might already have. It can be very frustrating to have a new version munge (e.g. formatting) of a current document one depends on, and not being able to ‘un-munge’ it.

  8. Works well. The only problem I had is that the icons were not created. I created them manually by running Writer, Calc and Impress and the using the “Lock to Launcher” option. This is how to run them from the terminal:

    Writer: /opt/libreoffice5.0/program/oosplash –writer
    Calc: /opt/libreoffice5.0/program/oosplash –calc
    Impress: /opt/libreoffice5.0/program/oosplash –impress

Leave a Comment

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