Skip to content

Instantly share code, notes, and snippets.

@kslimani
Last active June 8, 2019 14:56
Show Gist options
  • Save kslimani/618acec0f13a8a86517ba0e55d87195e to your computer and use it in GitHub Desktop.
Save kslimani/618acec0f13a8a86517ba0e55d87195e to your computer and use it in GitHub Desktop.
Linux Debian Stretch upgrade procedure

Linux Debian Stretch upgrade procedure

Source : https://www.linode.com/docs/security/upgrading/upgrade-debian-to-the-newest-release/

Starting a Screen Session

Start a screen session is recommended to ensure that the updates will continue to install in the unlikely event you are disconnected during the upgrade process.

Install screen package :

apt-get install screen

After installation has completed, start a screen session :

screen

If you are disconnected from your server, you can reconnect to the screen session by entering the following command :

screen -Dr

Update current packages

apt-get update
apt-get -y upgrade

Check package status

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

Backup

Before upgrading your system, it is strongly recommended that you make a full backup, or at least back up any data or configuration information you can't afford to lose.

Stop services

It is recommanded to stop some services like Apache, MySQL, Nginx, etc... Some services can also be disabled & re-enabled after upgrade.

Configure packages list to stretch

Edit /etc/apt/sources.list file (adapt to your needs) :

deb http://ftp.fr.debian.org/debian/ stretch main non-free contrib
deb-src http://ftp.fr.debian.org/debian/ stretch main non-free contrib

deb http://security.debian.org/ stretch/updates main non-free contrib
deb-src http://security.debian.org/ stretch/updates main non-free contrib

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

Upgrade to Stretch

apt-get update
apt-get install apt dpkg aptitude
apt-get dist-upgrade

Remove deprecated packages

apt-get autoremove

Check (AGAIN) package status

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

Some packages may require to be MANUALLY reinstalled or removed if deprecated/conflicted.

(OPTIONAL) make text boot the default under systemd

systemctl set-default multi-user.target

Note: to restore GUI boot

systemctl set-default graphical.target

Finally, reboot server

reboot

After reboot, services previously disabled can be re-enabled (if any).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment