Linux: Ubuntu 如何 在线升级系统
Ubuntu 如何升级更新系统
有也常用 Kali Linux 的小伙伴会很熟悉,在Kali中我们只需要使用apt/apt-get包管理器执行如下命令即可:
sudo apt update && apt upgrade -y 一般执行结束就已完成Kali系统的更新 或者再加上: sudo apt dist-upgrade -y (补充:apt-get full-upgrade 是重装式升级;会先删除软件,再对需要升级的软件包进行完整安装, 所以,做好重要数据的备份后谨慎操作。 而apt dist-upgrade -y 是解决依赖式升级,根据依赖关系的变化,自主添加或删除包)
但在Ubuntu中,这样的操作,只做了对软件仓库名和软件的更新,并未更新系统。那么该如何做呢?博主抽空做个简单的记录,方便各位参考:
方法一、Update Manager 更新
首先,在Terminal终端中更新:
sudo apt update && apt upgrade -y (若觉得速度慢,请移步百度更换apt/apt-get软件源)
其次,搜素 Update Manager 打开 Software Updater,选择 Updates项
找到 Notify me of a new Ubuntu Version,更改为:For any new version
退出重新打开 Software Updater,在线更新系统即可:
方法二、do-release-upgrade 命令(官方推荐)
同样,先在Terminal终端中进行软件更新:
sudo apt update && apt upgrade -y
有不了解该命令的朋友,可以先看看用法介绍:
root@ubuntu:~# sudo do-release-upgrade -h Usage: do-release-upgrade [options] Options: -h, --help show this help message and exit -V, --version Show version and exit -d, --devel-release If using the latest supported release, upgrade to the development release --data-dir=DATA_DIR Directory that contains the data files -p, --proposed Try upgrading to the latest release using the upgrader from $distro-proposed -m MODE, --mode=MODE Run in a special upgrade mode. Currently 'desktop' for regular upgrades of a desktop system and 'server' for server systems are supported. -f FRONTEND, --frontend=FRONTEND Run the specified frontend -c, --check-dist-upgrade-only Check only if a new distribution release is available and report the result via the exit code --allow-third-party Try the upgrade with third party mirrors and repositories enabled instead of commenting them out. -q, --quiet
博主推荐 -p 参数更新:
sudo do-release-upgrade -p (当然,读者亦可选-d参数,升级到最新的开发版本,但并不稳定。)
注意:
无论如上哪种方式,其本质都是一样的,并无多大区别,更新将会花费较多时间,请耐心等候!!
系统升级后,可删除无用软件和内核(根据个人喜好执行):
软件清除: sudo apt-get autoclean: 自主清理旧版本的软件缓存 sudo apt-get clean: 清理所有软件缓存 sudo apt-get autoremove: 自主删除系统不再使用的孤立软件 内核清除: dpkg --get-selections | grep linux 能看到已经安装的版本,其中带image的一般就是旧版本 deinstall指已经删除的旧版本 install表示还未删除的旧版本内核 清理残留数据: dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
参考资料:
1. Ubuntu社区官方论坛https://ubuntu.com/tutorials/upgrading-ubuntu-desktop#1-before-you-start*
2. How to upgrade from Ubuntu 18.04 LTS to 20.04 LTS today:https://ubuntu.com/blog/how-to-upgrade-from-ubuntu-18-04-lts-to-20-04-lts-today