I run Debian (pure Debian, not Ubuntu) on my server, and a week or so ago, Debian 7 (Wheezy) was released. I figured it would be worth the effort to upgrade, so I took about an hour of my Sunday to go through the process. Just in case I ever need to do it again, here’s how I did it. (I started from these upgrade steps.)
I take pretty regular backups. I run just a couple of sites on my server, and I use Panic’s Transmit to do a basic rsync of the files for my sites to my local machine (and then store those on Dropbox) to make sure I always have a copy of my sites. I made sure to also grab a few other things I backup (apache configs, mysql configs, vim configs, databases) so that I would have the freshest backups.
I also used my host’s snapshot feature to take a snapshot backup of my server. In a worst-case scenario, I would just go back to that state and pretend I never tried this whole thing. The backups cost me about $3/mo, which is well worth it to ensure I can always get my server back up and running.
Prepare for the upgrade
Debian still hasn’t quite figured out the seamless upgrade, so you have to do work some mojo. You need to edit your /etc/apt/sources.list file (likely as root or, the way I do it, via sudo) to replace everywhere it says “squeeze” with “wheezy” thats’s a debian repo. I didn’t replace the nginx repos, not knowing if they are updated yet.
Now, let’s start getting things upgraded. Anywhere I’m executing stuff, assume I’m running “sudo” before it. You might do it as root, or have your system setup differently.
apt-get update apt-get upgrade
Now wait a while. Every so often, you may get asked if you want to keep your changed version of a conf file. I’ve found that’s safer.
When that’s all done, let’s do a little house keeping.
apt-get autoclean apt-get autoremove
Those commands will clear out any old packages and free up some disk space. Depending on how much disk space you have free, that may be necessary for the upgrade to Debian Wheezy. (Then again, if you’re running things that close to the edge, you may not want to upgrade anyway.)
Now, the big one
Time to actually upgrade our version of Debian.
And now we wait. And wait. And wait a bit more.
And then, yikes. Some errors followed by this line:
NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
Turns out that sudo’s environment didn’t have those paths in it. I added those paths to my environment and then ran the upgrade like this:
sudo -E apt-get dist-upgrade
but a smarter way would be to add this line to your /etc/sudoers file
So, let’s try this again:
sudo -E apt-get dist-upgrade
And, once again, we wait and wait and wait. And, hey, we’re done! Except, mysql isn’t starting. Huh. Nor is apache2. Well, that’s not good for a web server.
Some reading of logs shows that I’ve got two settings in my /etc/my.cnf that mysql 5.5 doesn’t like. Commenting out these lines:
language = /usr/share/mysql/english skip-innodb
got mysql up and running.
Now, apache2 is complaining about a non-existent httpd.conf file. That file used to be there, but apparently the apache2 upgrade got rid of the empty file. I just commented out the line referencing it in my apache2.conf. And wouldn’t you know, apache2 starts up just fine.
I tested my sites, they all seem to work. I sent myself a test email, that seems to work too. I test a few other things (logging in via ssh, using git, checking the crontab) and everything looks to be working.
And, the denouement …
cat /etc/debian_version 7.0