Josselin Dionisi - Freelance developer

Steps to update your production server (Ubuntu)

ionicons-v5-k Josselin Dionisi May 14, 2025
85 reads Level: Beginner

Hello and thank you for clicking on this article!

Some time ago I told you about my nuclear disaster, the super adventure of a server that suddenly shuts down and gives no sign of life.

Recently I received an email from my service provider saying "Please note that your Ubuntu version will soon no longer be supported. You should upgrade to 22.04 minimum".

Well, even if this email seems nicer, I still had a feeling of déjà vu of my server getting lost in the cosmic universe and my sites/services with it. 😀

So what do we do in these cases?

The backup phase

Oh yes, there's no escaping that one. Imagine all your services going down all at once, with no way of restoring them to perfect working order quickly ... that would be a good Halloween scenario, but it's May. So we're saving. 🔄

Here, unlike last time, we're not just going to use duplicity. Understand that duplicity is useful for restoring services that are no longer in place. Right now, everything is running on my server, so I already have daily duplicity backups of each site. I just want to recover it "as is" if something goes wrong during the update.

That's why I've decided to compress most of the "useful" part of my server. So all my production folders and some configurations. I use the good old tar command and after a few minutes I'm left with my compressed folder.

If I have to start a new server from scratch, all I have to do is unzip this file on my server to recover my initial configuration.

Testing backup and compatibility

Now that I have an almost complete copy of the server, what I could possibly test is to deploy it on a virtual machine (VM) to check that everything actually restarts without a hitch.

You can use your favorite VM software (VirtualBox, VmWare, etc.) and launch an Ubuntu 22.04 version. Once it's launched, you'll need to upload your previously created tar.gz file and unzip it into the correct folder. You should then be able to find all your sites, services and configurations. If, like me, you're using docker to manage all this, restarting the containers should allow you to quickly see if everything is relaunching normally.

✅ Is it ok? If you haven't forgotten anything your Ubuntu upgrade should therefore go smoothly in production.
❌ Any errors or problems? Now's the time to take notes and try to solve them. Isn't it better to have it happen here in a neutral environment than on your real production? 😀

Update

So if we do a quick recap we have :

  • Our recurring backups of services and websites (with duplicity or other)
  • Our compressed server backup with all our important datas and configurations
  • A VM already running Ubuntu 22.04, which runs the same elements as our production server without errors or bugs.

With all these precautions, we can at least say that we've done our utmost to prepare the ground. Now it's time to run the stressful command: sudo do-release-upgrade

That's it, your update is launched, the packages will download and your server will restart. Yes, it's compulsory and your services will shut down for a few seconds, but if everything has been configured correctly, they should restart as soon as possible and without a hitch, since we've already run the VM tests.

Conclusion

As we saw in the previous article on recovering a crashed server, the key word here is backup. But the approach is a little different, because in the case of an upgrade, there's no urgency. So you have time to plan what you want to do, how you want to do it and, above all, to test different configurations to check what could go wrong.

You're lucky that between 20.04 and 22.04 there are few changes that impact our environment. The 24.04 update will be another story, but there's still time to think about it until 2027.

Until then, I wish you a good day and hope to see you soon 😀