Retrospecter... Now it's time to upgrade from Debian Wheezy to Jessie
As we saw in Retrospecter... Installing Drupal 8(I).- A small context, hosting and first problems, we need to upgrade ye olde Wheezy to Jessie in order to be able to continue installing, I will make a small break to talk about Debian's releases system.
Debian is a veteran on the scope of Linux distributions, on its pros it has a packet system of b inaries for several architectures, on its cons it has the same, maintaining binaries for several architectures makes the life cycle to bit slower than other distributions, Debian usually keeps three different threads of development (stable, testing y unstable) when a new release is moved from testing to stable the current stable becomes oldstable and gets only new security upgrades, stable releases use to be behind on software versions if the software is active and that's why there is a lot of people that uses testing or other linux distributions.
By the time it was written, Wheezy became oldstable and that's why we need to install stable Jessie.
Security over all
In order to make our distribution upgrade we can use apt (Debian's packet manager), we will go into that later but first of all we need to make a backup of things that can get "broken" duting the upgrade, in this case, I only need to keep config files and databases (PostgreSQL). To backup all these data we need to do:
tar -zcvf etc.tar.gz /etc
pg_dumpall -U username -h localhost -W -c > dump_postgres.sql
Now we need to take those files into a nice warm, secure place.
Before upgrading our distribution we need to make sure all packages in Wheezy are updated, the shorter the step the harder to fall, to do so, first of all make sure all your sources point to Wheezy, so we can avoid any unwilling accident, some installations tend to use the term stable instead of Wheezy on source files and this can be misleading:
We should have all pointing to Wheezy:
deb http://ftp.debian.org/debian wheezy main contrib non-free
deb-src http://ftp.de.debian.org/debian wheezy main contrib non-free
deb http://ftp.debian.org/debian wheezy-updates main contrib non-free
deb http://ftp.debian.org/debian-security wheezy/updates main contrib non-free
The exact mirror your system is using depends on your installer and your location. In the event you have added more repositories they should be on alternative sources directory: /etc/apt/sources.list.d so better check if you have something pointing to stable in there, when all is verified we can upgrade Wheezy:
At this poing and after some wait and a lot of messages in console all packages should be updated but there can be some of them on hold, we can verify doing:
dpkg --get-selections | grep hold
If there are not held packages we can cross fingers and start doing the distribution upgrade, I like doing it in two steps:
Upgrading to Jessie in two steps
First we need to do is editing our sources.list once again, if we are using vim, we can make a quick string replacement:
at this point we can install base packages with:
Once our base packages are installed and there are no issues installing or updating we can upgrade the distribution and in the event of no errors we can reboot:
Once server has rebooted we can check if we really have our Jessie:
Upgrading PostgreSQL cluster
If your Debian installation is not using meta-packages (those with no version on name), you can end up having a older PostgreSQL version (like 9.1) instead of the latest in Jessie (was 9.4 at this point), to fix this you have two options, uninstall, delete your cluster, reinstall and restore the backup you did or doing like it should, and the latter is the one I am going to show you, first install the new release:
apt-get install postgresql-9.4
And delete the newly created cluster:
pg_dropcluster --stop 9.4 main
Once you have done it you can upgrade your old 9.1 cluster to 9.4
pg_upgradecluster -v 9.4 9.1 main
pg_dropcluster 9.1 main
And that's al folks! If there are no smoke columns in the air we have just upgraded from Wheezy to Jessie.