Ubuntu的最新版本是20.04 LTS,并且代号为Focal Fossa。2020年4月23日发布的Ubuntu 20.04。此页面显示如何从apt命令 / apt-get命令将现有版本的Ubuntu Linux 18.04 LTS或19.10升级到Ubuntu 20.04 LTS 。
将Ubuntu 18.04升级到20.04的过程
- 创建服务器或虚拟机的备份。
- 通过运行sudo apt update && sudo apt upgrade命令升级所有已安装的Ubuntu 18.04版软件包。
- 重新启动Ubuntu Linux系统 sudo reboot command
- 安装Ubuntu更新工具,运行: sudo apt install update-manager-core
- 启动升级程序,运行: sudo do-release-upgrade
- 重新启动该框,运行: sudo reboot
- 验证升级
S1.进行备份
如果没有十足的把握,在进行操作之前进行一个备份,这也是一个十分良好的使用习惯。
lsb_release -a
显示如下信息:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic 记录linux内核版本: uname -mrs 比如会输出如下信息:
Linux 4.15.0-96-generic x86_64
S2.在Linux 18.04上安装所有的更新包
使用如下命令:
sudo apt update
sudo apt list --upgradable
sudo apt upgrade
然后重启系统: sudo reboot
S3. 移除Ubuntu 18.04上未用的旧包
sudo apt --purge autoremove
比如会输出:
Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: linux-headers-4.15.0-45* linux-headers-4.15.0-45-generic* linux-image-4.15.0-45-generic* linux-modules-4.15.0-45-generic* linux-modules-extra-4.15.0-45-generic* 0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded. After this operation, 334 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 138353 files and directories currently installed.) Removing linux-headers-4.15.0-45-generic (4.15.0-45.48) ...
确保您安装了update-manager-core软件包
我们需要在服务器上安装更新管理器,
sudo apt install update-manager-core
S4. 将Ubuntu18.04升级到最新的LTS
sudo do-release-upgrade
可能会输出:
Checking for a new Ubuntu release
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.
在这种情况下,请传递-d选项以强制获取最新的受支持版本:
sudo do-release-upgrade -d
可能会输出:
Reading cache Checking package manager Continue running under SSH? This session appears to be running under ssh. It is not recommended to perform a upgrade over ssh currently because in case of failure it is harder to recover. If you continue, an additional ssh daemon will be started at port '1022'. Do you want to continue? Continue [yN] y Starting additional sshd 一般一路选择Y即可
S5. 验证版本
检查发型版本,使用命令:lsb_release -a
比如会输出:
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal 检查内核版本: tail -f /var/log/my-app.log uname -mrs 可能会输出:
Linux 5.4.0-24-generic x86_64
S6. 启用或禁用第三方软件源
cd /etc/apt/sources.list.d/
根据需要进行配置,比如添加国内的镜像源等
S7. 如果是桌面系统。可以使用GUI方式进行升级
本文由作者 okass2 发布在 WirelessLink , 转载请联系客服授权处理,获得授权后请保留文章的完整性并附上原文链接: https://wirelesslink.net/6680.html