Ubuntu系统手动升级

1、sudo apt update

2、sudo apt upgrade -y

3、sudo do-release-upgrade

或是下面2个命令:
sudo apt update && apt upgrade -y
sudo do-release-upgrade 

ps:
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           
软件清除:

	sudo apt-get autoclean: 自主清理旧版本的软件缓存 /var/cache/apt/archives/
	sudo apt-get clean: 清理所有软件缓存 /var/cache/apt/archives/
	sudo apt-get autoremove: 自主删除系统不再使用的孤立软件,慎用
	
内核清除:	

	dpkg --get-selections | grep linux
	
	能看到已经安装的版本,其中带image的一般就是旧版本
	deinstall指已经删除的旧版本
	install表示还未删除的旧版本内核​​
	
清理残留数据:
	dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P 

(1) remove – 卸载软件包
(2) autoremove – 卸载所有自动安装且不再使用的软件包
(3) purge – 卸载并清除软件包的配置  


这里重点介绍一下autoremove:
apt-get autoremove的行为重点是卸载所有自动安装,例如:C 依赖于 B, D 依赖于B, 且D没有被其他手动安装的包依赖。 
apt-get remove C 将删除C, 同时提示你用apt-get autoremove去清除B,D ;
apt-get autoremove C 将删除B, C, D 。所以,这条命令最恐怖的是在不了解的情况下,你不知道他会把系统中的什么配置文件给删除.
查看已安装的软件:
 apt list --installed | grep -i package关键字
 dpkg --list | grep -i package关键字

source源换成国内:只针对20.04

1、sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、把下面内容copy覆盖到sources.list里,保存

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse

3、sudo apt update

常用的Ubuntu版本代号如下:

  • Ubuntu 22.04:jammy
  • Ubuntu 20.04:focal
  • Ubuntu 18.04:bionic
  • Ubuntu 16.04:xenial

参考:

Ubuntu 如何 在线升级系统_ubuntu_~晨曦静竹~-华为云开发者联盟

如何在Ubuntu中用apt命令删除/卸载软件包(remove/clean/purge)_ubuntu remove-CSDN博客

sudo apt-get autoremove最好不使用_sudo apt autoremove-CSDN博客

Ubuntu20.04更换国内镜像源(阿里、网易163、清华、中科大)_ubuntu_MidoQ-重庆城市开发者社区

ubuntu20.04更改为国内软件源_ubuntu20.04 ruanjianyuan-CSDN博客

Ubuntu 22.04 更换内地源_ubuntu22.04更换国内源-CSDN博客

Ubuntu系统界面卡死解决方案记录_ubuntu卡在开机界面-CSDN博客

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值