Upgrade Debian Jessie to Stretch, Buster and Beyond

So it’s been a while and we haven’t bothered updating that Debian 8 (Jessie) server, quite simply because it wasn’t broken … and we all know, if it’s not broken then there is no need to fix it.

However the time has come to upgrade, because you want to change out some of the other elements of the services on the server but they require a more recent version of Debian Linux.

Also, one final thing. Despite these fools stopping shipping Vi/Vim as an editor with Linux, I am using it in here and will continue to use it ’til the day I die or … ’til the day my fingers cease to function. Vi (or vim these days for the syntax highlighting) is the only editor that should be used by any self respecting sysadmin or coder.

We are using Debian here because when these services were set up, the choices weren’t as they are now and Debian was a lean, mean, service delivery machine.

In the first instance we need to make sure everything on the server is up to date and functioning as it should be. In an ideal world you will also back up the server at the point 😉 However, that said, it reminds me that if you are running your Debian 8 inside a container then you have some additional stuff you need to do to make your container work as required by Debian Buster.

You need to add a line to your containers configuration file:

> vi /var/lib/lxc/<container>/config

features: nesting=1
:wq

Now to make sure everything is up to date:

> sudo apt-get update
> sudo apt-get upgrade
> sudo apt-get dist-upgrade
> sudo apt-get autoremove

Once complete it is time to upgrade, you can call me paranoid if you wish, but I like to do things one release at a time, so I know where things go wrong, if of course they go wrong. They shouldn’t do, because we’re good … but it’s “those other people” that we need to worry about.

We need to update the sources.list to move from Jessie to Stretch:

> vi /etc/apt/sources.list

:%s/jessie/stretch/g
:wq

And now we repeat the update process, literally a rinse and repeat affair except with upgraded source lists.

> sudo apt-get update
> sudo apt-get upgrade
> sudo apt-get dist-upgrade
> sudo apt-get autoremove

Note: archive.debian.org becomes httpredir.debian.org which is only useful to know if you access backports in any way shape or form.

In theory, we are now running Debian Stretch. You can use whichever means you usually use to check. Now we have to upgrade from Debian Stretch to Debian Buster, that was we can ignore everything apart from security upgrades for a while 😉

> vi /etc/apt/sources.list

:%s/stretch/buster/g
:wq

And again, you’ve got it … update, upgrade, dist-upgrade.

> sudo apt-get update
> sudo apt-get upgrade
> sudo apt-get dist-upgrade
> sudo apt-get autoremove

You are now running Debian Buster! Congratulations!

If you need to upgrade your PHP whilst you’re at it (which is why I did this), be sure to check out the simple instructions for doing just that here.

One final point here, if you are going to run Apache in a container then you need to alter the apache.service in line with the additional features setting for the lxc container. So if you run into this “apache2.service: Failed at step NAMESPACE spawning /usr/sbin/apachectl: Permission denied” then you have forgotten to change the apache.service.

vi /lib/systemd/system/apache2.service

PrivateTmp=false
NoNewPrivileges=yes

:wq



Comments

Leave a Reply

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.