ubuntu21.04 升级 22.04问题

不要使用系统自带的更新程序,包括图形化界面和命令行

采用手工修改 apt 源文件:

首先更新 apt 源,替换  为 jammy

sed -i 's/focal/jammy/g' /etc/apt/sources.list
sed -i 's/focal/jammy/g' /etc/apt/sources.list.d/*.list

然后,修改 apt 源文件 /etc/apt/sources.list

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy universe
# deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu jammy partner
# deb-src http://archive.canonical.com/ubuntu jammy partner

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security main restricted
# deb-src http://archive.ubuntu.com/ubuntu jammy-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security universe
# deb-src http://archive.ubuntu.com/ubuntu jammy-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-security multiverse
# deb-src http://archive.ubuntu.com/ubuntu jammy-security multiverse


然后我们再次执行更新系统:

apt update
apt upgrade -y
apt dist-upgrade -y

更新过程种会提示一些软件是否需要自动重启,选 Yes 即可,以及一些软件的配置文件是否需要更新,按照自己的情况选择即可,默认回车即视为使用旧的配置文件,一般会出现在 OpenSSH 等软件的更新上。

更新后删除不必要的软件和依赖:

apt autoclean
apt autoremove -y

然后使用 reboot 命令重启系统,耐心等待后,查看最新的系统版本:

root@ubuntu ~ # lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy
root@ubuntu ~ # uname -a
Linux ubuntu 5.15.0-25 #4-Ubuntu SMP Fri Apr 1 07:36:38 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

这时我们就已经更新到了最新的 Ubuntu 22.04 Jammy 和内核了。

 

 

 

 

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要将Ubuntu 20.04升级Ubuntu 22.04,您需要先将系统更新Ubuntu 21.10版本。这是因为只有从Ubuntu 21.10版本才可以执行升级22.04的操作。因此,如果您目前使用的是Ubuntu 20.04或21.04版本,您需要先更新Ubuntu 21.10,然后再进行22.04升级升级的具体步骤如下: 1. 确保您的系统已连接到互联网,并且已经进行了所有的系统更新。您可以使用以下命令进行更新: ``` sudo apt update sudo apt upgrade ``` 2. 一旦您的系统已经完成了所有的更新,您可以开始升级Ubuntu 21.10版本。可以使用以下命令执行升级: ``` sudo do-release-upgrade ``` 3. 按照升级过程中的提示进行操作,包括确认升级和接受升级操作系统的许可协议。 4. 等待升级过程完成。这可能需要一些时间,取决于您的系统配置和网络速度。 5. 一旦升级到了Ubuntu 21.10版本,您可以继续执行升级Ubuntu 22.04的操作。可以使用以下命令执行升级: ``` sudo do-release-upgrade ``` 6. 再次按照升级过程中的提示进行操作,确认升级和接受许可协议。 7. 等待升级过程完成。同样,这可能需要一些时间,取决于您的系统配置和网络速度。 完成这些步骤后,您的系统将成功升级Ubuntu 22.04版本,并可以享受其提供的新功能和改进。请注意,在执行升级操作之前,请务必备份您的重要数据,以防万一。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [【无标题】如何从 Ubuntu 20.04 升级Ubuntu 22.04](https://blog.csdn.net/drivery/article/details/124398253)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [如何将 Ubuntu 升级22.04 LTS Jammy Jellyfish](https://blog.csdn.net/sirobot/article/details/128981403)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值