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

Ubuntu 16.04 LTS(LTS代表长期支持版本)系统上直接升级到较新版本并不建议,因为16.04已经到达其官方生命周期的后期,可能会遇到兼容性和安全性问题。不过,如果你想尝试,可以按照以下步骤操作: 1. **备份数据**:在升级前,请务必备份重要文件,以防升级过程中出现问题。 2. **更新现有的系统**:打开终端并运行 `sudo apt-get update` 和 `sudo apt-get upgrade` 来确保你的系统是最新的,并安装所有可用的安全补丁。 3. **迁移至更稳定的版本**:Ubuntu 有一个“子系列”概念,你可以选择下一个长期支持版本,如升级到18.04或20.04。为此,你需要先从软件源列表移除16.04,然后添加新版本的源: ```bash sudo rm /etc/apt/sources.list.d/ubuntu-16.04.list curl -fsSL https://www.ubuntu.com/download/repositories/ubuntu-cloud-$(lsb_release -cs)/main/bionic | sudo tee /etc/apt/sources.list.d/cloud-archive-bionic.list ``` 4. **安装新的软件包管理系统**:由于18.04及以后不再使用apt,而是apt-transport-https ca-certificates software-properties-common ``` 5. **添加新版本的主仓库**: ```bash sudo add-apt-repository "deb [arch=amd64] https://cloud-images.ubuntu.com/releases/bionic/current bionic main" ``` 6. **接受新版本的GPG密钥**: ```bash sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C900BFCE0354CA42 ``` 7. **更新源列表并准备安装**: ```bash sudo apt-get update ``` 8. **安装新版本的Ubuntu**: ```bash sudo do-release-upgrade ``` 但是请注意,这个过程可能不完全稳定,如果遇到问题,你可能需要手动处理某些部分。在实际操作前,最好查阅官方文档或者寻求社区的帮助。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

~晨曦静竹~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值