Ads (728x90)


Debian 8 was released a few days ago and while new users can simply download and install Jessie, those running Debian 7 Wheezy may want to upgrade their systems. The good news is Debian has a fairly easier and much trusted upgrade path. However, we do need to prepare our servers or machines for a smooth upgrade. This tutorial describes how to upgrade to Debian 8 from Debian 7.

Preparing Debian 7 for the upgrade

Before upgrading to new Debian 8, I strongly suggest you to backup all important data and configuration files in your system. Also, notify all other users who are currently using the system to take full backup of all their data. The important files/folders that needs to be backup are:
  • /etc/
  • /var/lib/dpkg
  • /var/lib/apt/extended_states
  • If you use aptitude, you must also backup: /var/lib/aptitude/pkgstates
  • And backup the output of the following command:
dpkg --get-selections "*"
Stop all running services, such as apache, nginx, mysql, or postgresql.
To stop a running service, for example nginx, run:
service nginx stop

Upgrade to Debian 8 Desktop

Here, We’ll be discussing how to upgrade to Debian 8 Jessie desktop from Debian 7 Wheezy.
Switch to root user:
su root
Edit /etc/apt/sources.list file,
nano /etc/apt/sources.list
Change all instances of wheezy to jessie.
This is how my sources.list file looked after replaced the line wheezy with jessie.
deb http://mirror.cse.iitk.ac.in/debian/ jessie main
deb-src http://mirror.cse.iitk.ac.in/debian/ jessie main

deb http://security.debian.org/ jessie/updates main contrib
deb-src http://security.debian.org/ jessie/updates main contrib

# wheezy-updates, previously known as 'volatile'
deb http://mirror.cse.iitk.ac.in/debian/ jessie-updates main contrib
deb-src http://mirror.cse.iitk.ac.in/debian/ jessie-updates main contrib
Run the following command to update packages list:
apt-get update
Then, run the minimal upgrade:
apt-get upgrade
sk@debian: ~_001Click Yes to restart services.
sk@debian: ~_003Finally, run the following command to perform full system upgrade.
apt-get dist-upgrade
sk@debian: ~_004The upgrade process will take a while depending upon your Internet connection speed.
During upgrade process, you’ll be asked to disable or enable ssh to root user. Enabling ssh for root user is such a bad idea. So, let’s disable it.
sk@debian: ~_005
A word of caution: If you disable ssh password authentication for root user, you no longer can access your Debian desktop from a remote system using root user. In such cases, you can ssh to your Debian desktop from a non-administrative user, for example sk.
Wait for a while to complete the upgrade.
sk@debian: ~_006We have successfully upgraded to Debian 8.
Before rebooting your machine, It is advisable to purge old packages.
To do that, run:
dpkg -l | awk '/^rc/ { print $2 }'
Sample output:
foomatic-filters
libaudit0
libcheese-gtk21:i386
libcheese3:i386
libcogl-pango0:i386
libcogl9:i386
libcupsdriver1:i386
libebook-1.2-13
libedata-book-1.2-13
libedataserverui-3.0-1
libescpr1:i386
libexttextcat0
libgjs0b
libgnome-desktop-3-2
libgoa-1.0-0:i386
libgraphite2-2.0.0
libgtksourceview-3.0-0:i386
libmetacity-private0a
libmutter0
libpackagekit-glib2-14:i386
libreoffice-filter-binfilter
libsnmp15
virtualbox-guest-x11
Remove all old and unnecessary packages using commands:
apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }')
apt-get autoremove
Finally, reboot your system.
Log in to the new Debian 8 Jessie desktop.
Debian 7 [Running] - Oracle VM VirtualBox_031Debian 7 [Running] - Oracle VM VirtualBox_032My Debian 8 system overview:
Debian 7 [Running] - Oracle VM VirtualBox_033Usually, Debian doesn’t allow non-administrative users to install/remove packages using sudo. We must manually add the users to the sudoers list to perform some administrative tasks.
To add non-administrative users to the sudoers list, do the following.
To do that, switch to root user:
su
Run the following command to install sudo:
apt-get install sudo
Add the current user(non-administrative user) to sudo group, for example my system user name is sk:
adduser sk sudo
Then, grant the sudo permission to the user sk.
To do that, edit:
visudo
Add the following line:
sk ALL = (ALL) ALL
Save and quit the file.
Type exit to return back to the normal user.
From now on you can install or remove any packages using non-administrative users.

Upgrade to Debian 8 server

If you’re planning to upgrade Debian 8 on your VPS, follow these steps.
Switch to root user, and install screen:
su root
apt-get install screen
Then, start screen session:
screen
The screen tool will help you to reconnect to your VPS, in case you’re disconnected from it while upgrading.
If you’re disconnected from your VPS, you can re-connect to it using command:
screen -Dr
Now, edit /etc/apt/sources.list file,
nano /etc/apt/sources.list
Change all instances of wheezy to jessie.
This is how my sources.list file looked after replaced the line wheezy with jessie.
deb http://mirror.cse.iitk.ac.in/debian/ jessie main
deb-src http://mirror.cse.iitk.ac.in/debian/ jessie main

deb http://security.debian.org/ jessie/updates main contrib
deb-src http://security.debian.org/ jessie/updates main contrib

# wheezy-updates, previously known as 'volatile'
deb http://mirror.cse.iitk.ac.in/debian/ jessie-updates main contrib
deb-src http://mirror.cse.iitk.ac.in/debian/ jessie-updates main contrib
Run the following command to update packages list:
apt-get update
Then, run the minimal upgrade:
apt-get upgrade
Finally, run the following command to perform full system upgrade.
apt-get dist-upgrade
Remove all old and unnecessary packages using commands:
apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }')
apt-get autoremove
Finally, reboot your VPS.
reboot
Done!

Possible problems after upgrading to Debian 8

If you got any problems with some packages, for example mysql, just install them again.
sudo apt-get install mysql-server
Still no luck, completely purge and re-install them as shown below.
sudo apt-get remove --purge mysql-server
sudo apt-get install mysql-server
While removing mysql-server, the installer will ask you whether to keep the configuration file or not. Just keep the configuration file and continue the installation.
That’s all.
Congratulations! Now, Debian 8 is ready to use.
Comments

Post a Comment