Upgrading Debian 8 Jessie to Debian 9 Stretch

Step 1: Back up any important data on the server
 
Make a backup – it cannot be stressed enough how important it is to make a backup of your system before you do this. Most of the actions listed in this tutorial are written with the assumption that they will be executed by the root user running the bash or any other modern shell. Type the following commands to see current version:
 
 
$ uname -mrs
 
 
Sample outputs:
 
 
 
Linux 3.16.0-4-amd64 x86_64
 
OR
 
 
$ lsb_release -a
 
 
Sample outputs:
 
 
 
No LSB modules are available.

Distributor ID: Debian

Description: Debian GNU/Linux 8.8 (jessie)

Release: 8.8

Codename: jessie
 
Step 2: Patch your existing system
 
Type the following apt-get command/apt command (we are assuming you have sudo installed, if you don't and are logged on as root, then simply remove the sudo from infront of all the following commands): 
 
 
$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get dist-upgrade
 
 
OR
 
 
$ sudo apt update

$ sudo apt upgrade

$ sudo apt dist-upgrade
 
Reboot the system if kernel or other libs are updates, run:
 
 
$ sudo reboot
 
 
Step 3: Update /etc/apt/sources.list file
 
Here is my default /etc/apt/sources.list
 
 
$ cat /etc/apt/sources.list
 
Sample outputs:
 
 
 
deb http://httpredir.debian.org/debian jessie main contrib

deb http://security.debian.org/ jessie/updates main
 
Update file as follows using the text editor such as joe command/vi command (replace jessie with stretch):
 
 
$ sudo vi /etc/apt/sources.list
 
Sample outputs:
 
deb http://httpredir.debian.org/debian stretch main contrib 

deb http://security.debian.org/ stretch/updates main
 
Save and close the file. To update list of available packages for stretch, run:
 
 
$ sudo apt-get update
 
Sample outputs:
 
Get:1 http://mirrors.kernel.org stretch InRelease [195 kB]

Get:2 http://security.debian.org stretch/updates InRelease [62.9 kB] 

Get:3 http://security.debian.org stretch/updates/main amd64 Packages [1,404 B] 

Get:4 http://security.debian.org stretch/updates/main Translation-en [1,767 B]

Get:5 http://mirrors.kernel.org stretch/contrib Translation-en [45.9 kB]

Get:6 http://mirrors.kernel.org stretch/main Translation-en [5,392 kB]

Get:7 http://mirrors.kernel.org stretch/main amd64 Packages [7,095 kB]

Get:8 http://mirrors.kernel.org stretch/contrib amd64 Packages [50.9 kB]

Fetched 12.8 MB in 6s (2,129 kB/s) 

Reading package lists... Done

Building dependency tree 

Reading state information... Done
 
 
See how much disk space needed for upgrade:
 
 
$ sudo apt-get -o APT::Get::Trivial-Only=true dist-upgrade
 
Sample outputs:
 
....

sysv-rc sysvinit-utils tar task-english task-ssh-server tasksel tasksel-data tcpd telnet texinfo time traceroute tzdata ucf udev util-linux util-linux-locales vim

vim-common vim-runtime vim-tiny w3m wget whiptail whois xauth xdg-user-dirs xkb-data xml-core xz-utils zlib1g

398 upgraded, 139 newly installed, 3 to remove and 0 not upgraded.

Need to get 213 MB of archives.

After this operation, 335 MB of additional disk space will be used.

E: Trivial Only specified but this is not a trivial operation.

See your free disk space with the NA command:
 
 
$ df -H
 
Sample outputs:
 
Filesystem      Size  Used Avail Use% Mounted on

/dev/sda         21G  1.1G   19G   6% /

udev             11M     0   11M   0% /dev

tmpfs           210M  4.5M  206M   3% /run

tmpfs           525M     0  525M   0% /dev/shm

tmpfs           5.3M     0  5.3M   0% /run/lock

tmpfs           525M     0  525M   0% /sys/fs/cgroup
 
 
To upgrade the system by installing/upgrading packages:
 
 
$ sudo apt-get upgrade
 
Sample outputs:
 
Reading package lists... Done

Building dependency tree 

Reading state information... Done

Calculating upgrade... The following packages were automatically installed and are no longer required:

docutils-common docutils-doc libasprintf0c2 liblcms2-2 libpaper-utils libpaper1 libperl4-corelibs-perl libuuid-perl libwebp5 libwebpdemux1 libwebpmux1 python-docutils

python-pil python-pygments python-roman

Use 'apt-get autoremove' to remove them.

Done

The following packages have been kept back:

apt apt-listchanges apt-utils aptitude aptitude-common bc bind9-host curl dbus dmsetup dnsutils eject exim4 exim4-base exim4-config exim4-daemon-light file ftp gnupg

gnupg-agent gnupg2 ifupdown init init-system-helpers initramfs-tools initscripts iotop iproute2 iptables iputils-ping isc-dhcp-client isc-dhcp-common

libarchive-extract-perl libavahi-client3 libc-bin libc6 libcairo2 libclass-c3-xs-perl libcpan-meta-perl libcryptsetup4 libcups2 libcurl3 libcurl3-gnutls libdbus-1-3

libdevmapper1.02.1 libfcgi-perl libfreetype6 libgcc1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgnutls-openssl27 libgtk2.0-0 libgtk2.0-bin libhtml-parser-perl

....

..

The following packages will be upgraded:

acl acpi acpi-support-base acpid adduser aptitude-doc-en at base-files base-passwd bash bash-completion bsd-mailx bsdmainutils bsdutils busybox bzip2 ca-certificates

console-setup console-setup-linux coreutils cpio cron dash dc debconf debconf-i18n debian-archive-keyring debian-faq debianutils dictionaries-common diffutils discover

dmidecode doc-debian docutils-common docutils-doc dpkg e2fslibs e2fsprogs findutils fontconfig fontconfig-config fonts-dejavu-core geoip-database gettext-base gpgv grep

groff-base grub-common grub-pc grub-pc-bin grub2-common gzip hicolor-icon-theme host hostname iamerican ibritish ienglish-common info insserv install-info

....

..

283 upgraded, 0 newly installed, 0 to remove and 115 not upgraded.

Need to get 69.9 MB of archives.

After this operation, 14.8 MB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://mirrors.kernel.org/debian/ stretch/main base-files amd64 9.9 [67.2 kB]

Get:2 http://mirrors.kernel.org/debian/ stretch/main libtinfo5 amd64 6.0+20161126-1 [299 kB]

....

....

.... 

Get:282 http://mirrors.kernel.org/debian/ stretch/main host all 1:9.10.3.dfsg.P4-12.3 [185 kB] 

Get:283 http://mirrors.kernel.org/debian/ stretch/main os-prober amd64 1.75 [29.8 kB] 

Fetched 69.9 MB in 1min 3s (1,104 kB/s) 

...

...

...

Processing triggers for libc-bin (2.19-18+deb8u9) ...

Processing triggers for systemd (215-17+deb8u7) ...

Processing triggers for ca-certificates (20161130+nmu1) ...

Updating certificates in /etc/ssl/certs...

0 added, 0 removed; done.

Running hooks in /etc/ca-certificates/update.d...

done.

Processing triggers for dictionaries-common (1.27.2) ...

ispell-autobuildhash: Processing 'american' dict.

ispell-autobuildhash: Processing 'british' dict.
 
Finally upgrade everything intelligently:
 
 
$ sudo apt-get dist-upgrade
 
 
 
Sample outputs:
 
Reading package lists... Done

Building dependency tree 

Reading state information... Done

Calculating upgrade... The following packages were automatically installed and are no longer required:

docutils-common docutils-doc libasprintf0c2 libbind9-90 libdns100 libintl-perl libintl-xs-perl libisc95 libisccc90 libisccfg90 libjasper1 liblcms2-2 liblwres90

....

..

Done

The following packages will be REMOVED:

libcwidget3 libsigc++-2.0-0c2a perl-modules

The following NEW packages will be installed:

dh-python dirmngr distro-info-data firmware-linux-free gcc-6-base gnome-icon-theme gnupg-l10n gtk-update-icon-cache initramfs-tools-core irqbalance keyutils libapparmor1

libapt-inst2.0 libapt-pkg5.0 libb-hooks-endofscope-perl libbind9-140 libboost-filesystem1.62.0 libboost-iostreams1.62.0 libboost-system1.62.0 libc-l10n

libclass-method-modifiers-perl libclass-xsaccessor-perl libcpan-changes-perl libcroco3 libcwidget3v5 libdata-perl-perl libdevel-caller-perl

....

..

The following packages will be upgraded:

apt apt-listchanges apt-utils aptitude aptitude-common bc bind9-host curl dbus dmsetup dnsutils eject exim4 exim4-base exim4-config exim4-daemon-light file ftp gnupg

gnupg-agent gnupg2 ifupdown init init-system-helpers initramfs-tools initscripts iotop iproute2 iptables iputils-ping isc-dhcp-client isc-dhcp-common

libarchive-extract-perl libavahi-client3 libc-bin libc6 libcairo2 libclass-c3-xs-perl libcpan-meta-perl libcryptsetup4 libcups2 libcurl3 libcurl3-gnutls libdbus-1-3

libdevmapper1.02.1 libfcgi-perl libfreetype6 libgcc1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgnutls-openssl27 libgtk2.0-0 libgtk2.0-bin libhtml-parser-perl

libintl-perl libldap-2.4-2 liblocale-gettext-perl libmagic1 libmodule-pluggable-perl libnet-ssleay-perl libparams-util-perl libpod-readme-perl libpython-stdlib

libpython2.7-minimal libpython2.7-stdlib librtmp1 libsasl2-2 libsasl2-modules libstdc++6 libsub-name-perl libsystemd0 libtext-charwidth-perl libtext-iconv-perl

libtext-soundex-perl libudev1 libuuid-perl libxml-libxml-perl libxml-parser-perl libxml2 linux-image-amd64 locales lsb-release mutt nfs-common openssh-client

openssh-server openssh-sftp-server openssl perl perl-base pinentry-gtk2 procps python python-apt python-debianbts python-minimal python-pil python2.7 python2.7-minimal

reportbug rsyslog systemd sysv-rc sysvinit-utils telnet texinfo udev util-linux util-linux-locales vim vim-common vim-runtime vim-tiny w3m wget

115 upgraded, 139 newly installed, 3 to remove and 0 not upgraded.

Need to get 143 MB of archives.

After this operation, 320 MB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://mirrors.kernel.org/debian/ stretch/main locales all 2.24-11 [3,290 kB]

Get:2 http://mirrors.kernel.org/debian/ stretch/main libc-l10n all 2.24-11 [819 kB]

..

... 

Get:253 http://mirrors.kernel.org/debian/ stretch/main publicsuffix all 20170424.0717-1 [98.2 kB] 

Get:254 http://mirrors.kernel.org/debian/ stretch/main python-debianbts all 2.6.1 [11.5 kB] 

Fetched 143 MB in 1min 11s (2,000 kB/s) 

....

Deferring configuration of apt-listchanges until python3 is available

(Reading database ... 32357 files and directories currently installed.)

Preparing to unpack .../locales_2.24-11_all.deb ...

....

Checking init scripts...
 
Next reboot by runing:
 
 
$ sudo reboot
 
 
Verify new upgrade
 
Type the following commands:
 
 
$ uname -mrs
 
Sample outputs:
 
Linux 4.9.0-3-amd64 x86_64

$ lsb_release -a
 
 
Sample outputs:
 
:No LSB modules are available.

Distributor ID: Debian

Description: Debian GNU/Linux 9.0 (stretch)

Release: 9.0

Codename: stretch
 
 
And there you have it, Debian 8 upgrade to Debian 9 complete!
  • debian 8, debian 9
  • 6 Utilizadores acharam útil
Esta resposta foi útil?

Artigos Relacionados

ownCloud Auto Install Script on Debian 7

Here is an easy way to install ownCloud on Debian 7 with a script, but first, for those who...

NGINX – Allow access only to certain IPs

Nginx has a nice module that not many people know about, it basically enables us...

How to configure NTP client in CentOS

What's NTP? NTP stands for Network Time Protocol, and it is an Internet protocol used to...

Initial Server Setup on CentOS 6

Here are some recommendations to setup your VPS or server when you first get it, some of these...

How To Install nginx on CentOS

What is NGINX? Nginx (pronounced "engine-x") is an open source reverse proxy server for HTTP,...