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

推荐订阅源

aimingoo的专栏
aimingoo的专栏
人人都是产品经理
人人都是产品经理
M
MIT News - Artificial intelligence
C
Cybersecurity and Infrastructure Security Agency CISA
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
Spread Privacy
Spread Privacy
P
Palo Alto Networks Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
T
The Blog of Author Tim Ferriss
The Cloudflare Blog
WordPress大学
WordPress大学
小众软件
小众软件
H
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Blog — PlanetScale
Blog — PlanetScale
V2EX - 技术
V2EX - 技术
H
Hacker News: Front Page
Last Week in AI
Last Week in AI
D
DataBreaches.Net
V
V2EX
S
Securelist
C
CXSECURITY Database RSS Feed - CXSecurity.com
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tenable Blog
Cloudbric
Cloudbric
月光博客
月光博客
Y
Y Combinator Blog
博客园 - 三生石上(FineUI控件)
N
News and Events Feed by Topic
K
Kaspersky official blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
S
Secure Thoughts
S
Security Affairs
W
WeLiveSecurity
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Last Watchdog
The Last Watchdog
AI
AI
有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
罗磊的独立博客
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
N
Netflix TechBlog - Medium
PCI Perspectives
PCI Perspectives
SecWiki News
SecWiki News
IT之家
IT之家
Microsoft Azure Blog
Microsoft Azure Blog
V
Visual Studio Blog

轶哥博客

blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog blog
blog
2022-03-20 · via 轶哥博客

由于RedHat停止了CentOS8的支持,同时RedHat允许开发者注册16个正版RHEL系统,我决定将部分 CentOS 8 服务器更新到 RHEL 8。以下两篇文章是官方发布的与之密切相关的内容:

CentOS Project shifts focus to CentOS Stream

New Year, new Red Hat Enterprise Linux programs: Easier ways to access RHEL

注意,因参考本文操作导致的任何损失与鄙人无关,专业用户请直接访问官方升级说明(请注意官方源无法使用,因此部分sed命令需要修改):https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/converting_from_an_rpm-based_linux_distribution_to_rhel/index

关于为什么不选择升级至CentOS Stream?

一直以来我的客户都在使用正版RHEL系统,购买了即时的订阅,只有部分预算有限的客户使用了CentOS系统,但无论如何他们对于安全、稳定性或技术支持即时性的要求都很高。

能够得到官方的技术支持是我们更加看重的。

目前不支持从CentOS Stream转换/升级到RHEL8,不排除将来也不支持,如果后续有升级需求将不得不重装系统。同理,已经升级到CentOS Stream的用户就别折腾了,必须重装。(只是因为更新到vault源更新过软件,cat /etc/system-release却得到CentOS Stream release 8,说明实际已经升级到CentOS Stream了,是不可以升级到RHEL 8的。)

升级到RHEL 8的准备工作

  1. Red Hat Developer program中进行注册并确保 https://access.redhat.com/management/subscriptions 中存在可用的订阅。
  2. 创建快照,备份数据
  3. 【如果当前版本不是CentOS 8.5.2111】更新到8.5版本,先确认yum update可以执行,如果无法执行,更换为国内源(CentOS 8操作系统版本结束了生命周期,阿里云等部分国内镜像站也移除了相应镜像源)。

官方源 -> 清华源,仅用于升级到8.5。

sed -i 's|^baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' /etc/yum.repos.d/CentOS-*

阿里云、华为云等云服务商的官方CentOS镜像使用的源也无法正常更新到RHEL,因此需要替换为centos-vault源(已包含在第三步脚本里)。

  1. 无脑复制下述命令并执行(再次提醒,系统升级是高危操作,具有重要资料或专业用户请参考上述官方文档):
cp -rf /etc/yum.repos.d /etc/yum.repos.d.backup
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
rm -rf /etc/yum.repos.d/CentOS-*
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
sed -i 's/^failovermethod/#failovermethod/g' /etc/yum.repos.d/CentOS-Base.repo
yum clean all && yum makecache
sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release https://www.redhat.com/security/data/fd431d51.txt
curl --create-dirs -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem
curl -o /etc/yum.repos.d/convert2rhel.repo https://ftp.redhat.com/redhat/convert2rhel/8/convert2rhel.repo
yum -y install convert2rhel

说明:官方文档里面的命令有错误,并且现在官方早已停止了CentOS 8的支持,源站停止,导致无法更新,因此只能用国内镜像。

升级RHEL 8

convert2rhel --username 用户名 --password 密码

使用准备工作中第一步创建的Red Hat账号的账号密码替换上面的用户名密码,并执行命令。需要注意,用户名不是登录邮箱,用户名可以登录后右上角去找。

命令执行过程中会展示不支持的软件包以及会被移除的软件,例如Docker,绝大部分场景可以直接用podman代替docker,如果必须使用Docker可以参考我另外一篇博文《CentOS8卸载podman安装docker》。

命令执行过程会提示使用到的订阅信息,需要进行选择。

如果看到提示:

WARNING - ********************************************************
WARNING - The tool allows rollback of any action until this point.
WARNING - By continuing all further changes on the system will need to be reverted manually by the user, if necessary.
WARNING - ********************************************************

之后千万不要手动退出,有些步骤会很慢类似假死,但是退出后将无法回滚。

等待 Convert2RHEL 安装 RHEL 包。

成功提示:

Conversion successful!

WARNING - In order to boot the RHEL kernel, restart of the system is needed.

一般情况下,命令执行完成后(升级大约需要2个小时),检查如果没啥红色信息,reboot重启即可。

如果升级过程出现错误,尝试回滚(Conversion rollback)或恢复备份。不过大部分情况也是无法回滚的,这种情况只能在命令后面增加--debug重新执行命令,同时对照https://github.com/oamg/convert2rhel/blob/main/convert2rhel/main.py的代码一步一步修改/usr/lib/python3.6/site-packages/convert2rhel/main.py进行调试。

升级后的检查

检查软件包,查看是否有不被支持的软件包:

yum list extras --disablerepo="*"

检查依赖关系:

yum check dependencies

查看订阅信息(留意到期时间):

sudo subscription-manager list --consumed

查看系统版本信息:

cat /etc/redhat-release