Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Postrediori/b837a45c7cbdd215fe6b646e495127a1 to your computer and use it in GitHub Desktop.
Save Postrediori/b837a45c7cbdd215fe6b646e495127a1 to your computer and use it in GitHub Desktop.
Upgrade DigitalOcean Ubuntu Droplet to the Next LTS Version

Description

The instructions here cover upgrading Ubuntu droplet from one LTS release to the next one. This was used to incrementally upgrade from Ubutnu 16.04 to 20.04 via 18.04.

Instructions

Perform standard update

sudo apt-get update
sudo apt-get upgrade -y

Update sources.list using the nearest repo server (e.g. de for droplets in Europe, us in the US, etc)

sudo sed -i 's/mirrors.digitalocean.com/de.archive.ubuntu.com/' /etc/apt/sources.list

Run do-release-upgrade

sudo do-release-upgrade

Revert sources.list back

sudo sed -i 's/de.archive.ubuntu.com/mirrors.digitalocean.com/' /etc/apt/sources.list

Repeat from the beginning to update to the next LTS version.

Note. Ater 22.04 -> 24.04 upgrade apr sources file moved to /etc/apt/sources.list.d/ubuntu.sources. This the final change of the sources file should be:

sudo sed -i 's/de.archive.ubuntu.com/mirrors.digitalocean.com/' /etc/apt/sources.list.d/ubuntu.sources

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment