Posted under » Ubuntu on 14 December 2022
If you want your ubuntu giving the latest php, then you should upgrade. Please note this could be a risky process and best that you start from scratch. Otherwise, make a full backup first.
This is my experience upgrading from 20.04 LTS Fossa to 22.04 LTS Jellyfish. As usual we begin as SUDO with
$ apt-get update $ apt-get upgrade
You do not need to turn on firewall if it is off in the first place.
You cannot do upgrade just using ssh port and you may need to open up incoming port 1022 if it is blocked. This is the default port set by the upgrade procedure as a fallback if the default SSH port dies during upgrades, just in case.
Let's begin the upgrade using the command line.
$ do-release-upgrade
Hit yes yes yes until you come to the point where it ask if you want ot delete obsolete packages after 15 minutes or so. This will be the end of it. It will say 'System upgrade is complete. Restart required'.
At this point, I said no. We need to ensure that my SSH is active so when I reboot I can still log in.
If you press reboot and you are able to login then you haz success.
The good thing about upgrading is that you don't have to install LAMP again but you may have to reconfigure it if something doesn't work as it should. For example, somehow it is still loading the old php7 config and thus apache won't start.
To fix this, as SUDO you
$ rm /etc/apache2/mods-enabled/php7.4.load $ rm /etc/apache2/mods-enabled/php7.4.conf
Then you replace it with
$ ln -s /etc/apache2/mods-available/php8.1.load /etc/apache2/mods-enabled/ $ ln -s /etc/apache2/mods-available/php8.1.conf /etc/apache2/mods-enabled/
Restart Apache and it should work.
For Django, I have the issue of Venv that is for Python 3.10 which doesn't work if your venv was from 3.8.
One option is to downgrade your Python.
However the best option is to recreate the venv for 3.10 because you will be using the latest Python and libraries.