Ubuntu 16.04 升级20.04 教程

 更新系统环境为升级做准备

apt update

apt upgrade -y

apt dist-upgrade -y

apt autoclean

apt autoremove -y

升级之后需要进行重启,建议重启让最新的内核生效。

重新获取最新的 gitlab Key

从官网查看解决方法:https://docs.gitlab.com/omnibus/update/package_signatures

# Download the new key
curl https://packages.gitlab.com/gpg.key -o /tmp/omnibus_gitlab_gpg.key

# Import the key
## Debian/Ubuntu/Raspbian
$ sudo apt-key add /tmp/omnibus_gitlab_gpg.key

# CentOS/OpenSUSE/SLES
$ sudo rpm --import /tmp/omnibus_gitlab_gpg.key

升级更新

$ sudo apt upgrade

安装发生中断

$ sudo apt-get upgrade
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
$ sudo ps -eaf | grep -i apt
$ sudo lsof /var/lib/dpkg/lock-frontend
$ sudo kill -9 PID
$ sudo dpkg --configure -a

先升级到18.04

$ sudo do-release-upgrade
Checking for a new Ubuntu release
You have not rebooted after updating a package which requires a reboot. Please reboot before upgrading.

重启Server

$ sudo reboot

重新执行升级命令

$ sudo do-release-upgrade

升级完成后重启系统

System upgrade is complete.

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

$ sudo reboot

重复前面的命令升级到20.04

$ sudo apt update
$ sudo apt upgrade
$ sudo do-release-upgrade

遇到了错误

Checking for a new Ubuntu release
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
There is no development version of an LTS available.
To upgrade to the latest non-LTS develoment release
set Prompt=normal in /etc/update-manager/release-upgrades.

修改文件/etc/update-manager/meta-release中的https改为http

[METARELEASE]
URI = https://changelogs.ubuntu.com/meta-release
URI_LTS = http://changelogs.ubuntu.com/meta-release-lts
URI_UNSTABLE_POSTFIX = -development
URI_PROPOSED_POSTFIX = -proposed

遇到boot空间不足问题

Not enough free disk space

The upgrade has aborted. The upgrade needs a total of 137 M free
space on disk '/boot'. Please free at least an additional 14.5 M of
disk space on '/boot'. You can remove old kernels using 'sudo apt
autoremove' and you could also set COMPRESS=xz in
/etc/initramfs-tools/initramfs.conf to reduce the size of your
initramfs.

清理旧内核

$ uname -a
$ dpkg --get-selections | grep linux-image
$ sudo apt remove linux-image-xxx
$ sudo update-grub

重新执行升级命令

$ sudo do-release-upgrade

升级完成


查询版本号

cat /etc/issue

评论

此博客中的热门博文

通过Graphql成功地查询Contentful,以便在我的gatsby项目中访问和显示图像

Oracle忘了保存,Oracle Cloud甲骨文云服务器忘记SSH秘钥或未设置Public key的解决办法...

Nginx【Docker系列】一个反向代理神器——Nginx Proxy Manager