惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Latest
Security Latest
Recent Commits to openclaw:main
Recent Commits to openclaw:main
O
OpenAI News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 最新话题
N
News | PayPal Newsroom
S
Secure Thoughts
The Last Watchdog
The Last Watchdog
Help Net Security
Help Net Security
V2EX - 技术
V2EX - 技术
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园_首页
博客园 - 司徒正美
The Cloudflare Blog
D
DataBreaches.Net
Jina AI
Jina AI
L
LINUX DO - 热门话题
宝玉的分享
宝玉的分享
Project Zero
Project Zero
量子位
Spread Privacy
Spread Privacy
Cisco Talos Blog
Cisco Talos Blog
J
Java Code Geeks
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News and Events Feed by Topic
PCI Perspectives
PCI Perspectives
Hugging Face - Blog
Hugging Face - Blog
T
Threat Research - Cisco Blogs
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog
AI
AI
C
CXSECURITY Database RSS Feed - CXSecurity.com
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
Attack and Defense Labs
Attack and Defense Labs
V
V2EX
人人都是产品经理
人人都是产品经理
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
博客园 - 三生石上(FineUI控件)
Cyberwarzone
Cyberwarzone

烧饼博客

Ubuntu 24.04 Noble 升级 Ubuntu 26.04 Resolute WSL 2 使用 Docker 桥接模式网络访问 HTTPS 超时的解决方法 Debian / Ubuntu 下使用 nginx-acme 自动签发并配置 SSL 证书 使用 acme.sh 配置 Let's Encrypt 签发的 IP 地址 SSL 证书 RDAP.SS - 基于 RDAP 协议的 Whois 查询网站 Debian 使用 extrepo 配置第三方软件源 升级 Debian 后 GitLab PostgreSQL 无法启动的解决方法 Debian 12 Bookworm 升级 Debian 13 Trixie Docker 安装 FreshRSS 教程 Docker 安装 Shlink 自建短网址 Debian 安装 Nextcloud 服务端 Debian 双栈网络时开启 IPv4 优先 Debian / Ubuntu 使用源安装 LAMP 教程 Debian / Ubuntu 使用源安装 LEMP 教程
Ubuntu 22.04 Jammy 升级 Ubuntu 24.04 Noble
Showfom · 2024-06-21 · via 烧饼博客
Ubuntu 22.04 Jammy 升级 Ubuntu 24.04 Noble

本文将指导如何升级 Ubuntu 22.04 Jammy Jellyfish 到 Ubuntu 24.04 Noble Numbat。

相关教程:Ubuntu 20.04 Focal Fossa 升级 Ubuntu 22.04 Jammy Jellyfish

#准备工作

除非你是物理服务器,以及没有用过奇奇怪怪定制或修改的内核的 KVM 构架的 VPS 和云主机,否则升级大版本更新内核是有一定机率导致 Grub 加载失败的,切记备份重要数据!

OpenVZ 和 LXC 构架的 VPS 是无法升级的,因为他们没有自己独立的内核

再强调一遍,一定要备份重要数据!

以下操作需要在 root 用户下完成,请使用 sudo -isu root 切换到 root 用户进行操作

#更新系统

首先需要更新你当前的系统

apt update
apt upgrade -y
apt dist-upgrade -y
apt autoclean
apt autoremove -y

如果内核更新了,可以重启让最新的内核生效,也可以直接进行升级。

#升级系统

这里有两种升级系统的方法,第一种是使用 do-release-upgrade 命令,第二种是手动更新 apt 源文件。

#方法一:使用 do-release-upgrade 命令

首先需要安装 ubuntu-release-upgrader-core 包:

apt install ubuntu-release-upgrader-core

然后修改 /etc/update-manager/release-upgrades 文件,确保 Prompt 值为 lts

cat /etc/update-manager/release-upgrades | grep lts

显示如下内容即可:

root@ubuntu ~ # cat /etc/update-manager/release-upgrades | grep lts
#  lts    - Check to see if a new LTS release is available.  The upgrader
Prompt=lts

最后执行以下命令升级系统:

#方法二:手动更新 apt 源文件

首先更新 apt 源,替换 jammynoble

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

系统 apt 源文件 /etc/apt/sources.list 应该是类似这样的:

deb https://archive.ubuntu.com/ubuntu/ noble main restricted universe multiverse

deb https://archive.ubuntu.com/ubuntu/ noble-updates main restricted universe multiverse

deb https://archive.ubuntu.com/ubuntu/ noble-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse

由于在 Ubuntu 24.04 之前,Ubuntu 的软件源配置文件使用传统的 One-Line-Style,路径为 /etc/apt/sources.list;从 Ubuntu 24.04 开始,Ubuntu 的软件源配置文件变更为 DEB822 格式,路径为 /etc/apt/sources.list.d/ubuntu.sources参考),所以使用 DEB822 格式的源文件 /etc/apt/sources.list.d/ubuntu.sources

Types: deb
URIs: https://archive.ubuntu.com/ubuntu
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: http://security.ubuntu.com/ubuntu
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

国内服务器可以替换 archive.ubuntu.comsecurity.ubuntu.commirrors.tuna.tsinghua.edu.cn

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

apt update
apt upgrade -y
apt full-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 24.04 LTS
Release:	24.04
Codename:	noble
root@ubuntu ~ # uname -a
Linux ubuntu 6.8.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

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