You Only Live Once
This will not be such a YOLO experience, because the whole upgrading from Wheezy to Jessie (stable) went smoothly. I describe the whole process below.
I'm not such a great risk taker as to jump head first to the newest and shiniest things that appear. No, I'm using Debian as my main desktop OS for about a year now and I upgraded to Jessie from Wheezy sometimes in February. It all went great with that upgrade, and I had no issues with the OS ever since - this is the reason that made me confident that the upgrade from Wheezy to Jessie is smooth and easy.
I'm not such a great risk taker as to jump head first to the newest and shiniest things that appear. No, I'm using Debian as my main desktop OS for about a year now and I upgraded to Jessie from Wheezy sometimes in February. It all went great with that upgrade, and I had no issues with the OS ever since - this is the reason that made me confident that the upgrade from Wheezy to Jessie is smooth and easy.
About The Upgraded Machine
Hardware
The hardware is a dedicated server hosted on Hetzner. I love Hetzner because they offer beefy machines to low prices. This server is a dedicated Intel(R) with an i7 CPU 950 @ 3.07GHz and 24 GB of RAM for which I pay just 34 EUR/month, VAT included.
Software
- Operating System: Debian Wheezy 7.7
- Web Servers: nginx and apache, but only nginx is running
- Programming Languages used: Perl (of course), PHP, Python, nodejs
- DB engines: MariaDB v10.0, mongodb,
Upgrading from Wheezy to Jessie
If you have valuable services running on your server, or you keep important data on your machine, or you can't afford some downtime, please read the official doc for upgrade (you can find the link in the External Resources section, below in this article). Heck, you should have a look at it anyways, because the points being emphasized there are really strong and are things that we all should incorporate in our daily lives as server owners. I found that documentation a little too verbose for my tastes and I wanted to see how the whole upgrade process works out without guidance. It worked out outstandingly well.
As I said, this process worked smoothly for me and there are huge chances that it'll be the same for you and that is just because of the great people behind the whole Debian project. Thank you Debian guys and girls for this great OS.
As I said, this process worked smoothly for me and there are huge chances that it'll be the same for you and that is just because of the great people behind the whole Debian project. Thank you Debian guys and girls for this great OS.
Upgrade Process Overview:
- Check the current configured apt sources
- Upgrade all the packages to their latest version through apt
- Modify the /etc/apt/sources.list to contain the stable repositories
- Upgrade again
- Upgrade the whole distribution
- Debian Upgrade From Wheezy to Jessie Process Step by Step
- Upgrade the packages and cleanup the old ones
- Reboot and start the custom services
1. Check the current configured apt sources
Check the configured repositories and see if the current distribution version is named wheezy or stable. On this hetzner machine it was named wheezy, so no matter how many times I issued apt-get dist-upgrade, it wouldn't have updated it. You can check this by opening the /etc/apt/sources.list file and see how the lines are looking. For example, I had these:
deb http://mirror.hetzner.de/debian/packages wheezy main contrib non-free
deb http://mirror.hetzner.de/debian/security wheezy/updates main contrib non-free
The bold wheezy text above says that apt should look for updates in the wheezy repos, not in the stable repos. Let it like that for now.
WARNING: If they point to the stable version instead of the wheezy version, you'll have to adjust the steps described in this tutorial. Your upgrade process is even simpler, all you have to do is issue an apt-get dist-upgrade.
2. Upgrade all the packages to their latest version through apt
Optional. This step is most probably optional, but since I did it, I include it. Just issue this as root:
apt-get update && apt-get upgrade
3. Modify the /etc/apt/sources.list to contain the stable repositories
Make a backup of your /etc/apt/sources.list file, or just edit the file and comment out all the entries you have, then go to this Debian Sources List Generator and configure the repositories you want to be included. Since Hetzner is located in Germany, I chose the Germany mirrors and now my /etc/apt/sources.list contains this:
deb http://ftp.de.debian.org/debian stable main non-free
deb http://ftp.debian.org/debian/ stable-updates main non-free
deb http://security.debian.org/ stable/updates main non-free
The generator will considers wheezy as stable and you'll have to replace the wheezy text to either stable, or jessie. I prefer stable.
4. Upgrade again all the packages
Optional. This step is most probably also not necessary, but since I did it, I include this too. Again, as root:
apt-get update && apt-get upgrade
5. Upgrade the whole distribution
This is the big moment has come. As root, without hesitating (because you know, YOLO), issue the upgrading command:
apt-get dist-upgrade
On my server the upgrade took around 20 minutes, including the time the interface was locked waiting for my input and the time it took me to smoke a cigarettes (I had to, because the adrenaline was rushing through my veins).
6. Debian Upgrade From Wheezy to Jessie Process Step by Step
Although the upgrading process is straight forward and without any surprises, you'll have to stay near the console while it happens, because it requires your input:
6.1 Permissions to restart your services during the upgrade automatically
I allowed it to do it and I have no regrets for doing it.
6.2 Installing the new GRUB
I didn't knew what to do here. After a brief search on the internet, I decided to go with the recommendation from the installer and checked all the partitions.
It gave some errors telling that it couldn't install GRUB on the /dev/md1 and /dev/md2 partitions and the install went on with no problems in the end. It's probably also OK to install GRUB only on /dev/sda and /dev/sdb:
Chose Continue.
6.3 Disabling password authentication through open-ssh
It looks like the default in Debian Jessie is to not allow root login with password authentication:
While this is a great security improvement, I was logged in remotely with root, with password. Although I have the public key authentication set up for other accounts with sudo rights, I didn't want to risk to be left outside the server, so I chose No for this. I've taken notice of this suggestion and I'll probably update the OpenSSH config later.
6.4 Config files overwriting for the rest of the updated services
During the whole upgrading process, new version of services will be installed. If you've customized the previous services, you'll be prompted whether you wish to install the new config or keep the old one. I chose to keep the customized version for absolutely all the services I was prompted to update.
7. Upgrade the packages and cleanup the old ones
After the whole upgrade process is finished, I issued another apt-get update && apt-get upgrade to make sure everything is up to date. There were no packages updated, but it showed that some packages were installed and no longer needed.
Issue an apt-get autoremove as root in order to have them removed.
8. Reboot
Because of the above errors when installing GRUB, this was the step to give me the biggest emotions. Given today is Sunday and I don't have that many people relying on my sites, I considered it to be the optimum moment to find out if something goes wrong when rebooting.
It didn't and the server rebooted quite fast (less than a minute)
It didn't and the server rebooted quite fast (less than a minute)
External Resources
Again, if you're not that much into YOLO-ing, I strongly recommend you to at least have a look at the official docs for upgrading from Wheezy to Jessie.
If you liked the photos in this post and you want to help promoting Debian, check the DebianArt page, grab them and update your social profiles and web pages with those beautiful images.
Conclusions
The whole process to upgrade the Debian production server from Wheezy to Jessie took about an hour and offered no unpleasant surprises. Instead it offers some pleasant ones:
- Perl version is 5.20.2, the latest stable version at the current moment.
- kernel version is 3.16.0-4-amd64, which means you I have no more excuses to not start playing with Docker
- libc is at version 2.19-18 vs 2.13-38 in wheezy
- And many many more
Final thoughts
This is my very first step by step guide regarding upgrading an OS. Also, I'm a Perl developer and not a sysadmin, so if you have some observations or want to give advice regarding the above tutorial, please either provide them in the comments below, or send me an email to tudorconstantin __at__ gmail.com to update this article.