Upgrading Debian Squeeze server to Debian Wheezy server

My web and others servers was set up on Debian Squeeze about a year ago. and they have been working great. But it thought it was about time to upgrade all my Debian servers to Wheezy instead so I could get some newer updates for packages and in general be up-to-date.
Here is the simple, fast and trouble free way I did it.

Making a backup of your configuration files

This can break your server, so be sure to have a up-to-date backup nearby in case something goes wrong.
The thing you really dont want to loose are your configuration files. Just think if you have to set up that FTP server, that Webserver or some other service your configured a year ago? Can you really remember how you did all that? I don’t think so. To make sure you alway have your configuration files, use the following command:

tar -czvf host.etc.tar.gz /etc

It will create a backup file of your /etc/ folder. copy it to another server, USB flash drive or upload it somewhere so it is on some other disk that the server you want to upgrade.

Preparing the system for the update

When the backup is located on some other server, it’s time to prepare for the upgrade.

Clean your sources file

Your sources file (/etc/apt/sources.list) should look like the following. Edit it using your favorite text editor:

deb http://ftp.dk.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.dk.debian.org/debian/ squeeze main contrib non-free
deb http://security.debian.org/ squeeze/updates main contrib non-free
deb-src http://security.debian.org/ squeeze/updates main contrib non-free
# squeeze-updates, previously known as 'volatile'
deb http://ftp.dk.debian.org/debian/ squeeze-updates main contrib non-free
deb-src http://ftp.dk.debian.org/debian/ squeeze-updates main contrib non-free

The country code in the urls should match your country. Mine i Denmark, so it says “ftp.dk.debian.org”.
Change it in the lines you copied over to your sources.list

Making the Squeeze system up-to-date

Making sure all packages are up-to-date is a good idear, so run the following commands:
Updating the package list

apt-get update

Upgrading the existing packages

apt-get upgrade

followed by this

apt-get dist-upgrade

Make sure no packages are on hold, or only half installed

Ensure that no packages are on hold using the following commands:

dpkg --audit
dpkg --get-selections | grep hold

No packages can be on hold, if the commands above did not output anything, then you are good to go!
Now run the following to make sure no packages are scheduled for installation, removing or upgrading:

aptitude

Press “g” and if nothing shows up in the list, you are good to go. else press “g” again to make aptitude run the schedules and resolve the issues for you.
press “g” until it says that nothing is scheduled and then “q” to quit aptitude

Upgrading to Debian Wheezy

Once everything above is done successfully, you can go on and upgrade to Debian Wheezy.

Update sources.list for Debian Wheezy packages

Edit the file /etc/apt/sources.list with your favorite text editor like Nano or Vi.
Delete all the lines, and put in theese:

deb http://ftp.dk.debian.org/debian wheezy main contrib non-free
deb-src http://ftp.dk.debian.org/debian wheezy main contrib non-free
deb http://ftp.dk.debian.org/debian wheezy-updates main contrib non-free
deb http://ftp.dk.debian.org/debian-security wheezy/updates main contrib non-free

Remember to change it from DK to your country code again.

Update your package list

Update your package list with the Debian Wheezy packages now that you have updated your sources list, running the following:

apt-get update

Upgrade to Debian Wheezy

It’s time.
The time to run the upgrade!
Run the following, and answer NO if it asks to replace configuration files! (might or might not happen depending on what you use the server for), else everything should just be default answers (Was in my case) but read what the server asks you and do not just press Enter to everything without thinking first like a maniac!
After some seconds or a minute, when finished downloading the packages, it will show you a changelog in full screen that you can view by using the arrow keys. Once done reading it (you don’t have to), you have to exit it using the key “q” (Thats a small “Q” not a small “G”) on your keyboard.

apt-get upgrade

It might take some time, once done successfully, run the following:

apt-get dist-upgrade

This might take some time as well.
Once everything is completed successfully, you can reboot the server by just typing:

reboot

That’s it. you are now running Debian Wheezy instead of Debian Squeeze!
You can verify this by running this command:

cat /etc/*-release

Leave a Reply

Your email address will not be published.