升级搬瓦工vps的ubuntu版本
升级步骤
-
更新系统软件
[email protected]:~# apt-get update [email protected]:~# apt-get upgrade -y [email protected]:~# apt-get dist-upgrade
-
移除不必要软件
[email protected]:~# apt-get autoremove
-
安装更新管理器
[email protected]:~# apt-get install update-manager-core
-
更新系统
注意,不要ssh登录执行,使用vnc来操作。
[email protected]:~# do-release-upgrade
-
我的系统是16.04的,执行完是升级到18.04,如果要升级到20.04就再重复一遍上面的步骤即可。
遇到的问题
-
do-release-upgrade
执行一半提示/boot
空间不足,没办法清理boot空间,删多余的内核吧。-
查看当前系统使用的内核
[email protected]:~# uname -a Linux koomu.cn 4.15.0-142-generic #146~16.04.1-Ubuntu SMP Tue Apr 13 09:27:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
-
查看安装的内核
[email protected]:~# dpkg --get-selections |grep linux-image|grep -v deinstall linux-image-4.15.0-139-generic install linux-image-4.15.0-140-generic install linux-image-4.15.0-142-generic install linux-image-generic-hwe-16.04 install
-
删除旧内核
[email protected]:~# apt-get remove linux-image-4.15.0-139-generic linux-image-4.15.0-140-generic linux-image-generic-hwe-16.04
-
清理无用包
[email protected]:~# apt-get autoremove
等空间释放后,再次执行更新命令即可。
-
-
中间过程会有选择提示,比如是否要保留现有配置啥的,一定要保留啊,要不就等着重新配置现有的服务啥的吧。
-
从16.04升级后DNS失效问题
Ubuntu20.04 LTS 版本安装之后网络管理方式变了,导致原来设置的DNS失效。
-
首先修改
/etc/systemd/resolved.conf
[email protected]:~# cat /etc/systemd/resolved.conf # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Entries in this file show the compile time defaults. # You can change settings by editing this file. # Defaults can be restored by simply deleting this file. # # See resolved.conf(5) for details [Resolve] DNS=8.8.8.8 8.8.4.4 #FallbackDNS= #Domains= #LLMNR=no #MulticastDNS=no #DNSSEC=no #DNSOverTLS=no #Cache=no-negative #DNSStubListener=yes #ReadEtcHosts=yes
-
以root身份执行
[email protected]:~# systemctl restart systemd-resolved [email protected]:~# systemctl enable systemd-resolved [email protected]:~# mv /etc/resolv.conf /etc/resolv.conf.bak [email protected]:~# ln -s /run/systemd/resolve/resolv.conf /etc/
-