One of the advantages of Debian operating system is the ability to live update a production server from current to next release. Under normal circumstances you do not have to re-setup the system. So you avoid downtime, something critical for server systems.
There are possibilities this procedure to fail, so you must take a full system backup before.
Debian Jessie ships with Apache 2.4 There are some important changes with this version, which could break your current configuration. Details below.
The same procedure can be applied to desktop machines. There is more complexity in this case, due to graphical desktop environment.
Detailed official documentation is available here: Upgrades from Debian 7 (wheezy).
Here I describe a successful upgrade of a Debian LAMP server system from Wheezy to Jessie.
1. Backup your system
Take a full system backup.
2. Perform a full system update
Use:
apt-get update && apt-get -V upgrade
IMPORTANT NOTE: reboot if needed (details here).
3. Get current status
Use:
lsb_release -a
uname -a
and probably
hostnamectl
In my case:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.8 (wheezy)
Release: 7.8
Codename: wheezy
uname -a
Linux saas.medisign.com 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u2 x86_64 GNU/Linux
4. Change repositories
Replace “wheezy” with “jessie” in /etc/apt/sources.list, either manually or
sed -i 's/wheezy/jessie/g' /etc/apt/sources.list
NOTE: do not forget to change other files you probably have in /etc/apt/sources.list.d
So, in my case, the old version
#######################################################################################
# Hetzner APT-Mirror
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
#######################################################################################
# Backupmirror
#
deb http://cdn.debian.net/debian/ wheezy main non-free contrib
deb-src http://cdn.debian.net/debian/ wheezy main non-free contrib
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
will become
#######################################################################################
# Hetzner APT-Mirror
deb http://mirror.hetzner.de/debian/packages jessie main contrib non-free
deb http://mirror.hetzner.de/debian/security jessie/updates main contrib non-free
#######################################################################################
# Backupmirror
#
deb http://cdn.debian.net/debian/ jessie main non-free contrib
deb-src http://cdn.debian.net/debian/ jessie main non-free contrib
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
5. Perform a full system update (again)
Use:
apt-get update && apt-get -V upgrade
IMPORTANT NOTE: reboot if needed (details here).
IMPORTANT NOTE: sometimes (especially if you use systemd in Wheezy) system hangs in this step. See more details here. You may get a message like:
Setting up liblvm2cmd2.02:amd64 (2.02.111-2.2) ...
Setting up dmeventd (2:1.02.90-2.2) ...
Failed to parse message: No such device or address
In ths case:
reboot
and then
dpkg --configure -a
apt-get -f install
The result of the apt-get update && apt-get -V
upgrade
command in this step will be something like
this:
The following packages have been kept back:
acpid apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apt apt-utils apticron aptitude aptitude-common at base-passwd bind9-host
bsdutils btrfs-tools cron curl dbus dmsetup dnsutils dpkg exim4 exim4-base exim4-config exim4-daemon-light fontconfig-config gdisk gettext
initramfs-tools initscripts intel-microcode iproute iptables iputils-ping isc-dhcp-client isc-dhcp-common libapache2-mod-php5 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap libapt-pkg-perl libapt-pkg4.12 libasprintf0c2 libauthen-pam-perl libcryptsetup4 libcurl3 libcurl3-gnutls
libcwidget3 libdevmapper-event1.02.1 libdevmapper1.02.1 libept1.4.12 libfontconfig1 libgcc1 libgettextpo0 libglib2.0-0 libgomp1 libio-pty-perl
libldap-2.4-2 liblocale-gettext-perl libnet-ssleay-perl libp11-kit0 libpam-modules libpam-modules-bin libpam-systemd libpam0g libsasl2-2
libsemanage-common libsemanage1 libssh2-1 libstdc++6 libsystemd-journal0 libtext-charwidth-perl libtext-iconv-perl libusb-1.0-0 libuuid-perl libxapian22
linux-image-amd64 login lvm2 mc mc-data memcached mount openssh-client openssh-server passwd perl perl-base perl-modules php5 php5-cli php5-common
php5-curl php5-gd php5-intl php5-mcrypt php5-memcached procps python python-apt python-minimal python2.7 python2.7-minimal rsyslog shared-mime-info
systemd sysv-rc sysvinit sysvinit-utils texinfo ttf-dejavu-core udev util-linux util-linux-locales wget
The following packages will be upgraded:
acpi acpi-support-base apt-listchanges apt-show-versions autopoint base-files bash bash-completion binutils bsdmainutils busybox bzip2 ca-certificates
console-setup console-setup-linux coreutils cpio dash dctrl-tools debconf debconf-i18n debian-archive-keyring debian-goodies debianutils diffutils
discover discover-data dmidecode e2fslibs e2fsprogs eject ethtool file findutils firmware-linux-free firmware-realtek ftp gettext-base git git-man gnupg
gpgv grep groff-base grub-common grub-pc grub-pc-bin grub2-common gzip heirloom-mailx host hostname htop ifupdown iso-codes iucode-tool kbd
keyboard-configuration klibc-utils kmod less libacl1 libapr1 libapt-inst1.5 libattr1 libblkid1 libbsd0 libbz2-1.0 libc-bin libc6 libcap2 libcap2-bin
libclass-isa-perl libcomerr2 libcroco3 libdbus-1-3 libdiscover2 libedit2 liberror-perl libevent-2.0-5 libexpat1 libfreetype6 libfuse2 libgc1c2 libgdbm3
libgeoip1 libglib2.0-data libgpg-error0 libgpm2 libgssapi-krb5-2 libidn11 libk5crypto3 libkeyutils1 libklibc libkmod2 libkrb5-3 libkrb5support0
liblockfile-bin libltdl7 liblzma5 libmagic1 libmcrypt4 libmount1 libncurses5 libncursesw5 libnewt0.52 libnfnetlink0 libonig2 libopts25 libpam-cap
libpam-runtime libpci3 libpcre3 libpipeline1 libpng12-0 libpopt0 libqdbm14 libreadline5 libreadline6 libsasl2-modules libselinux1 libsepol1
libsigc++-2.0-0c2a libslang2 libsqlite3-0 libss2 libssl1.0.0 libswitch-perl libsystemd-daemon0 libsystemd-id128-0 libsystemd-login0 libtinfo5
libunistring0 libusb-0.1-4 libustr-1.0-1 libuuid1 libwrap0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxml2 libxmuu1 libxpm4 locales
logrotate lsb-base lsb-release man-db manpages mdadm mime-support mlocate module-init-tools multiarch-support nano ncurses-base ncurses-bin ncurses-term
net-tools netbase netcat-traditional ntp openssl p7zip-full patch pciutils psmisc python-apt-common readline-common rkhunter rsync sed sensible-utils
ssl-cert tar tasksel tasksel-data tcpd time traceroute tzdata ucf unzip usbutils vim vim-common vim-runtime vim-tiny w3m whiptail whois xauth xfsprogs
xkb-data xz-utils zlib1g
199 upgraded, 0 newly installed, 0 to remove and 116 not upgraded.
Need to get 72.6 MB of archives.
After this operation, 43.3 MB of additional disk space will be used.
Do you want to continue [Y/n]?
┌──────────────────────────────────────────────────────────────┤ Configuring libc6:amd64 ├──────────────────────────────────────────────────────────────┐
│ │
│ There are services installed on your system which need to be restarted when certain libraries, such as libpam, libc, and libssl, are upgraded. Since │
│ these restarts may cause interruptions of service for the system, you will normally be prompted on each upgrade for the list of services you wish to │
│ restart. You can choose this option to avoid being prompted; instead, all necessary restarts will be done for you automatically so you can avoid │
│ being asked questions on each library upgrade. │
│ │
│ Restart services during package upgrades without asking? │
│ │
│ <Yes> <No> │
│ │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────────┤ Configuring grub-pc ├────────────────────────────────────────────────────────────────┐
│ The GRUB boot loader was previously installed to a disk that is no longer present, or whose unique identifier has changed for some reason. It is │
│ important to make sure that the installed GRUB core image stays in sync with GRUB modules and grub.cfg. Please check again to make sure that GRUB is │
│ written to the appropriate boot devices. │
│ │
│ If you're unsure which drive is designated as boot drive by your BIOS, it is often a good idea to install GRUB to all of them. │
│ │
│ Note: it is possible to install GRUB to partition boot records as well, and some appropriate partitions are offered here. However, this forces GRUB │
│ to use the blocklist mechanism, which makes it less reliable, and therefore is not recommended. │
│ │
│ GRUB install devices: │
│ │
│ [ ] /dev/sda (2000398 MB; WDC_WD2000FYYZ-01UL1B2) │
│ [ ] /dev/sdb (2000398 MB; WDC_WD2000FYYZ-01UL1B2) │
│ [ ] /dev/md1 (536 MB; rescue:1) │
│ [ ] /dev/md2 (1982543 MB; rescue:2) │
│ │
│ │
│ <Ok> │
│ │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
6. Upgrade system
Use:
apt-get dist-upgrade
The result will be something like this:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
gcc-4.7-base libaudit0
The following NEW packages will be installed:
acl apache2-bin apache2-data cgmanager dmeventd fonts-dejavu-core gcc-4.9-base init init-system-helpers iproute2 irqbalance libalgorithm-c3-perl
libarchive-extract-perl libasprintf-dev libatm1 libaudit-common libaudit1 libauthen-sasl-perl libbind9-90 libboost-iostreams1.55.0 libcap-ng0
libcgi-fast-perl libcgi-pm-perl libcgmanager0 libclass-c3-perl libclass-c3-xs-perl libcpan-meta-perl libdata-optlist-perl libdata-section-perl libdb5.3
libdebconfclient0 libdns-export100 libdns100 libencode-locale-perl libestr0 libfcgi-perl libffi6 libfile-listing-perl libfont-afm-perl libgcrypt20
libgd3 libgettextpo-dev libgmp10 libgnutls-deb0-28 libgnutls-openssl27 libhogweed2 libhtml-form-perl libhtml-format-perl libhtml-parser-perl
libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libicu52
libintl-perl libio-html-perl libio-socket-ssl-perl libirs-export91 libisc-export95 libisc95 libisccc90 libisccfg-export90 libisccfg90 libjbig0
libjpeg62-turbo libjson-c2 liblog-message-perl liblog-message-simple-perl liblogging-stdlog0 liblognorm1 liblua5.1-0 liblvm2cmd2.02
liblwp-mediatypes-perl liblwp-protocol-https-perl liblwres90 liblzo2-2 libmailtools-perl libmemcached11 libmemcachedutil2 libmodule-build-perl
libmodule-pluggable-perl libmodule-signature-perl libmro-compat-perl libnet-http-perl libnet-smtp-ssl-perl libnettle4 libnih-dbus1 libnih1 libnuma1
libpackage-constants-perl libparams-util-perl libperl4-corelibs-perl libpod-latex-perl libpod-readme-perl libprocps3 libpsl0 libpython-stdlib
libpython2.7-minimal libpython2.7-stdlib libregexp-common-perl librtmp1 libsasl2-modules-db libsmartcols1 libsoftware-license-perl libsub-exporter-perl
libsub-install-perl libsystemd0 libtasn1-6 libterm-ui-perl libtext-soundex-perl libtext-template-perl libtext-unidecode-perl libtiff5 libtimedate-perl
libudev1 liburi-perl libvpx1 libwww-perl libwww-robotrules-perl libxml-libxml-perl libxml-namespacesupport-perl libxml-parser-perl libxml-sax-base-perl
libxml-sax-expat-perl libxml-sax-perl libxtables10 linux-image-3.16.0-4-amd64 openssh-sftp-server php5-json php5-readline rename startpar systemd-shim
systemd-sysv xdg-user-dirs
The following packages will be upgraded:
acpid apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common apt apt-utils apticron aptitude aptitude-common at base-passwd bind9-host
bsdutils btrfs-tools cron curl dbus dmsetup dnsutils dpkg exim4 exim4-base exim4-config exim4-daemon-light fontconfig-config gdisk gettext
initramfs-tools initscripts intel-microcode iproute iptables iputils-ping isc-dhcp-client isc-dhcp-common libapache2-mod-php5 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap libapt-pkg-perl libapt-pkg4.12 libasprintf0c2 libauthen-pam-perl libcryptsetup4 libcurl3 libcurl3-gnutls
libcwidget3 libdevmapper-event1.02.1 libdevmapper1.02.1 libept1.4.12 libfontconfig1 libgcc1 libgettextpo0 libglib2.0-0 libgomp1 libio-pty-perl
libldap-2.4-2 liblocale-gettext-perl libnet-ssleay-perl libp11-kit0 libpam-modules libpam-modules-bin libpam-systemd libpam0g libsasl2-2
libsemanage-common libsemanage1 libssh2-1 libstdc++6 libsystemd-journal0 libtext-charwidth-perl libtext-iconv-perl libusb-1.0-0 libuuid-perl libxapian22
linux-image-amd64 login lvm2 mc mc-data memcached mount openssh-client openssh-server passwd perl perl-base perl-modules php5 php5-cli php5-common
php5-curl php5-gd php5-intl php5-mcrypt php5-memcached procps python python-apt python-minimal python2.7 python2.7-minimal rsyslog shared-mime-info
systemd sysv-rc sysvinit sysvinit-utils texinfo ttf-dejavu-core udev util-linux util-linux-locales wget
116 upgraded, 138 newly installed, 2 to remove and 0 not upgraded.
Need to get 109 MB of archives.
After this operation, 262 MB of additional disk space will be used.
Do you want to continue [Y/n]?
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ⤠Modified configuration file ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â A new version (/usr/share/php5/php.ini-production) of configuration file /etc/php5/apache2/php.ini is available, but the version installed currently â
â has been locally modified. â
â â
â What do you want to do about modified configuration file php.ini? â
â â
â install the package maintainer's version â
â keep the local version currently installed â
â show the differences between the versions â
â show a side-by-side difference between the versions â
â start a new shell to examine the situation â
â â
â â
â <Ok> â
â â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
7. Fix Apache 2.4 configuration
Debian Jessie ships with Apache 2.4 There are some important changes with this version, which could break your current configuration. For example
- Since Apache 2.4, each virtual host file should have the .conf extension
- Either all Options must start with + or -, or no Option may
- Directives Order allow,deny and allow from all are deprecated. Use Require all granted instead.
See all changes in details here.
Check your configuration using
apachectl configtest
8. Reboot
Use:
reboot
or
systemctl reboot
9. Remove unused packages
Use:
apt-get autoremove
The result will be something like this:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
apache2.2-bin apache2.2-common git git-man libbind9-80 libcurl3-gnutls libdns88 liberror-perl libffi5 libgd2-xpm libicu48 libisc84 libisccc80
libisccfg82 libjpeg8 liblwres80 libmemcached10 librtmp0 libsystemd-daemon0 libsystemd-id128-0 libsystemd-journal0 libsystemd-login0 openssh-blacklist
openssh-blacklist-extra ttf-dejavu-core
0 upgraded, 0 newly installed, 25 to remove and 0 not upgraded.
After this operation, 59.1 MB disk space will be freed.
Do you want to continue? [Y/n]
10. Get new status
Use:
lsb_release -a
uname -a
hostnamectl
In my case:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.1 (jessie)
Release: 8.1
Codename: jessie
uname -a
Linux saas.medisign.com 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64 GNU/Linux
hostnamectl
Static hostname: saas.medisign.com
Icon name: computer-desktop
Chassis: desktop
Machine ID: 5541c1bbfe0541d48b10b3f3cc95b1eb
Boot ID: 1537a735a7a24ffc9d8ad6d3f9adf224
Operating System: Debian GNU/Linux 8 (jessie)
Kernel: Linux 3.16.0-4-amd64
Architecture: x86-64
Summary
Here is a summary of the steps to upgrade Wheezy to Jessie:
- Backup your system
- Full system update
apt-get update && apt-get -V upgrade
(reboot if needed) - Get current status (
lsb_release -a
|uname -a
and probablyhostnamectl
) - Replace “wheezy” with “jessie” in /etc/apt/sources.list
- Full system update (again)
apt-get update && apt-get -V upgrade
(reboot if needed) - System upgrade
apt-get dist-upgrade
- Fix Apache 2.4 configuration
- Reboot
- Remove unused packages
apt-get autoremove
- Get new status (
lsb_release -a
|uname -a
|hostnamectl
)
Entrepreneur | Full-stack developer | Founder of MediSign Ltd. I have over 15 years of professional experience designing and developing web applications. I am also very experienced in managing (web) projects.