又新入了一个搬瓦工CN2线路KVM主机,好折腾于是装了不熟悉的Debian 9,尝试升级Linux内核的时候搜到的文章大多是使用Ubuntu的deb安装,其实这样装上去是会有副作用的,比如我这就总提示需要 apt --fix-broken install ,所以还是再记录下如何使用官方源更新吧。

修改更新源

1
yee@debian:~$ sudo sh -c 'echo -e "deb http://http.debian.net/debian stretch-backports main\ndeb-src http://http.debian.net/debian stretch-backports main" > /etc/apt/sources.list.d/sources.list.bak'

更新package

1
2
yee@debian:~$ sudo apt-get update
yee@debian:~$ sudo apt-get dist-upgrade

安装新版内核镜像

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
yee@debian:~$ sudo apt-cache search linux-image

linux-headers-4.9.0-3-amd64 - Header files for Linux 4.9.0-3-amd64
linux-headers-4.9.0-3-rt-amd64 - Header files for Linux 4.9.0-3-rt-amd64
linux-image-4.9.0-3-amd64 - Linux 4.9 for 64-bit PCs
linux-image-4.9.0-3-amd64-dbg - Debug symbols for linux-image-4.9.0-3-amd64
linux-image-4.9.0-3-rt-amd64 - Linux 4.9 for 64-bit PCs, PREEMPT_RT
linux-image-4.9.0-3-rt-amd64-dbg - Debug symbols for linux-image-4.9.0-3-rt-amd64
linux-image-amd64 - Linux for 64-bit PCs (meta-package)
linux-image-amd64-dbg - Debugging symbols for Linux amd64 configuration (meta-package)
linux-image-rt-amd64 - Linux for 64-bit PCs (meta-package), PREEMPT_RT
linux-image-rt-amd64-dbg - Debugging symbols for Linux rt-amd64 configuration (meta-package)
linux-headers-4.11.0-0.bpo.1-amd64 - Header files for Linux 4.11.0-0.bpo.1-amd64
linux-headers-4.11.0-0.bpo.1-rt-amd64 - Header files for Linux 4.11.0-0.bpo.1-rt-amd64
linux-image-4.11.0-0.bpo.1-amd64 - Linux 4.11 for 64-bit PCs
linux-image-4.11.0-0.bpo.1-amd64-dbg - Debug symbols for linux-image-4.11.0-0.bpo.1-amd64
linux-image-4.11.0-0.bpo.1-rt-amd64 - Linux 4.11 for 64-bit PCs, PREEMPT_RT
linux-image-4.11.0-0.bpo.1-rt-amd64-dbg - Debug symbols for linux-image-4.11.0-0.bpo.1-rt-amd64

yee@debian:~$ sudo apt-get install -t stretch-backports linux-image-amd64

重启收工

1
2
3
yee@debian:~$ sudo update-grub
yee@debian:~$ sudo apt-get clean
yee@debian:~$ sudo reboot

检查下,已经切到了新内核

1
2
3
yee@debian:~$ uname -r

4.11.0-0.bpo.1-amd64

那么就再做下后续清理工作吧

1
2
yee@debian:~$ sudo apt purge linux-image-4.12.6-041206-generic
yee@debian:~$ sudo apt purge linux-image-4.9.0-3-amd64

注: 魔改BBR参考VPS零号机计划:(4)科学上网,唯一的不同是第一步安装Linux-header需要使用命令:

1
yee@debian:~$ sudo apt-get install -t stretch-backports linux-headers-amd64

20170830 update

手动更新内核方法:

1
2
3
4
5
6
7
8
yee@debian:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-image-4.12.0-1-amd64_4.12.6-1_amd64.deb
yee@debian:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-kbuild-4.12_4.12.6-1_amd64.deb
yee@debian:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-headers-4.12.0-1-common_4.12.6-1_all.deb
yee@debian:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-headers-4.12.0-1-amd64_4.12.6-1_amd64.deb
yee@debian:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-headers-4.12.0-1-all-amd64_4.12.6-1_amd64.deb
yee@debian:~$ wget http://mirrors.kernel.org/debian/pool/main/l/linux/linux-headers-4.12.0-1-all_4.12.6-1_amd64.deb

yee@debian:~$ sudo dpkg -i linux-*.deb
  • dpkg -l | grep linux 便能看到新安装的内核了,余下步骤同上操作。