Debian 7.8 (Wheezy) 升级 Debian 8.0 (Jessie) 备忘及教程

免责声明

本教程在 Debian 7.8 (Wheezy) 中测试通过,但由于服务器 / VPS 的不同,不保证此教程在所有服务器 / VPS 中都能正常运行。

因此,请先做完整的备份或者服务器快照!

准备阶段

我测试的是 ikoula 的 5 欧独立服务器,CPU 是 ATOM 520

root@imlonghao:~# cat /etc/debian_version
7.8

如果你不是 Debian 7.8 的,请参照下文升级到这个版本(部分被省略)

root@imlonghao:~# apt-get update
Hit http://ftp.debian.ikoula.com wheezy Release.gpg
Hit http://ftp.debian.ikoula.com wheezy Release
Hit http://ftp.debian.ikoula.com wheezy/main Sources
Hit http://ftp.debian.ikoula.com wheezy/contrib Sources
Hit http://ftp.debian.ikoula.com wheezy/non-free Sources
Hit http://ftp.debian.ikoula.com wheezy/main amd64 Packages
[...]
Reading package lists... Done
root@imlonghao:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

升级过程会更新我们系统的内核,因此,如果你对内核有要求的话请谨慎!

这是升级前的内核

root@imlonghao:~# uname -a
Linux imlonghao 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux

这是升级前的 sources.list

root@imlonghao:~# cat /etc/apt/sources.list
deb http://ftp.debian.ikoula.com/debian/ wheezy main contrib non-free
deb-src http://ftp.debian.ikoula.com/debian/ wheezy main contrib non-free

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

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

我们需要将 sources.list中的 wheezy 替换为 jessie ,运行下面语句

root@imlonghao:~# sed -i "s/wheezy/jessie/g" /etc/apt/sources.list
root@imlonghao:~# cat /etc/apt/sources.list
deb http://ftp.debian.ikoula.com/debian/ jessie main contrib non-free
deb-src http://ftp.debian.ikoula.com/debian/ jessie main contrib non-free

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

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

##开始升级

更新源

root@imlonghao:~# apt-get update
Get:1 http://ftp.debian.ikoula.com jessie Release.gpg [2,390 B]
Get:2 http://ftp.debian.ikoula.com jessie Release [126 kB]
Get:3 http://ftp.debian.ikoula.com jessie/main Sources [7,065 kB]
Get:4 http://security.debian.org jessie/updates Release.gpg [1,571 B]
Get:5 http://security.debian.org jessie/updates Release [61.5 kB]
[...]
Fetched 20.1 MB in 9s (2,208 kB/s)
Reading package lists... Done

开始更新,这里可能会比较耗时,不过我的 Atom 服务器用时也不长。

如果你的服务器丢包严重,建议使用 screen

root@imlonghao:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  [...]
The following NEW packages will be installed:
  [...]
The following packages have been kept back:
  [...]
The following packages will be upgraded:
  [...]
322 upgraded, 197 newly installed, 3 to remove and 1 not upgraded.
Need to get 221 MB of archives.
After this operation, 387 MB of additional disk space will be used.
Do you want to continue [Y/n]?

更新完后,reboot 重启系统

更新完毕

重启系统后,我们就可以看到我们现在已经成功更新到 Debian8.0 了,而内核也有了升级。

root@imlonghao:~# cat /etc/debian_version
8.0
root@imlonghao:~# uname -a
Linux imlonghao 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64 GNU/Linux