泓泰

CentOS 7 升级 CentOS 8 失败,系统崩了

admin
CentOS 7 升级 CentOS 8 失败,系统崩了-第1张-游戏信息-泓泰

前言:

而今看官们对“dnf为什么youarethebest”都比较关怀,各位老铁们都需要学习一些“dnf为什么youarethebest”的相关知识。那么小编也在网络上搜集了一些对于“dnf为什么youarethebest””的相关文章,希望你们能喜欢,同学们一起来了解一下吧!

最近准备研究 eBPF 并在安装 Cilium 时才发现对操作系统内核有最低版本要求,官网写明了要求: Linux kernel >= 4.9.17。而我现有机器系统都是CentOS 7.x的,内核版本:3.10.0,不满足Cilium的安装条件,暂时并不想重做系统,所以准备尝试将现有的操作系统从CentOS 7升级到CentOS 8,然后再升级内核版本到5.x以上,看看是否可行,说干就干,生命就在与不停的“折腾”。

Cilium install

Cetnos 停服历史背景:前段时间CentOS 7停止维护的话题炒得非常火热,众所周知的CentOS 7已经于2024年6月30日正式停止维护了。 之后将CentOS系列将无法接收新的安全更新,无法获得新的Bug修复,这样还在使用CentOS的老用户将更容易受到漏洞攻击,系统也因为不再有官方支持而出现新的问题和异常故障。所以CentOS的用户尽快切换操作系统吧,比如可以考虑下Debian和Ubuntu。

回归正文,下面详细记录了本次折腾的历程,真是一把心酸一把泪:

系统升级前的状况:

# cat /etc/redhat-release

CentOS Linux release 7.9.2009 (Core)

# uname -a

Linux dev-15-44 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

安装EPEL库,如果已经安装过可以略过

# yum install epel-release -y

安装 yum-utils 和 rpmconf 工具

# yum install yum-utils rpmconf -y# rpmconf -aConfiguration file '/etc/dnsmasq.conf'-rw-r--r--. 1 root root 26832 Jul 21 2021 /etc/dnsmasq.conf.rpmnew-rw-r--r--. 1 root root 197 Feb 20 2023 /etc/dnsmasq.conf==> Package distributor has shipped an updated version.What would you like to do about it ? Your options are:Y or I : install the package maintainer's versionN or O : keep your currently-installed versionD : show the differences between the versionsM : merge configuration filesZ : background this process to examine the situationS : skip this fileThe default action is to keep your current version.*** aliases (Y/I/N/O/D/M/Z/S) [default=N] ?Your choice: y

清理包

# package-cleanup --leaves# package-cleanup --orphans

CentOS 8已经使用dnf来替换yum作为包管理器,所以先用yum安装dnf

# yum install dnf -y

安装完dnf后,yum将会退出历史的舞台,卸载掉yum

# /bin/dnf remove yum yum-metadata-parser -y# rm -Rf /etc/yum

升级 CentOS 7 系统:

# dnf upgrade

安装 CentOS 8:

# dnf install http://vault.centos.org/8.5.2111/BaseOS/\x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.\rpm,centos-linux-release-8.5-1.2111.el8.noarch.rpm,\centos-gpg-keys-8-3.el8.noarch.rpm}

需要一段时间,看你网络情况,这是你可以去做20个开合跳。

升级操作系统成功,当前版本已经为, CentOS Linux release 8.5.2111 ,只是内核版本还是3.10

升级 EPEL 库

# dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

清理所有临时文件:

# dnf clean all

删除 CentOS 7 内核

# rpm -e `rpm -q kernel`

执行有报错,由于有依赖关系,实际执行中需要一块删除依赖的几个包。

# rpm -e `rpm -q kernel` hypervvssd-0-0.34.20180415git.el7.x86_64 hypervkvpd-0-0.34.20180415git.el7.x86_64 hypervfcopyd-0-0.34.20180415git.el7.x86_64 lldpad-1.0.1-5.git036e314.el7.x86_64 hyperv-daemons-0-0.34.20180415git.el7.x86_64 lldptools-1.0-0.el7.x86_64

删除 CentOS 7 内核后,删除所有冲突的软件包:

# rpm -e --nodeps sysvinit-tools

## 更新下载 CentOS 8国内源

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

## 升级CentOS 8

# dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-syncTotal download size: 815 M

这里需要下载800多兆的数据

$ cat /etc/redhat-releaseCentOS Linux release 8.5.2111

步骤#5:安装 CentOS 8 内核

现在,您需要使用以下命令安装 CentOS 8 内核核心:

# dnf -y install kernel-core --allowerasing 有报错

安装 CentOS 8 最小软件包:

# dnf -y groupupdate "Core" "Minimal Install" --allowerasing

#出现错误(centos8.0 软件仓库报错)

#清理仓库缓存

# dnf clean all

#重新生成缓存

# dnf repolist

看报错的意思是gcc版本需要升级

dnf upgrade kexec-tools systemd-sysv systemd-udev systemd python-libs gnupg2 audit-libs -y --best --allowerasingdnf upgrade gcc annobin mariadb-connector-c mariadb-connector-c-config redhat-rpm-config dracut-network -y --best --allowerasingdnf upgrade --best --allowerasing rpmdnf install sysvinit-tools pidof

有病乱投医

rpm --rebuilddb

删除

rpm -e python3-setuptools python3 python3-pip \       python36-rpm python3-libs openssl

然后系统就挂了,ssh无法登录,欲哭无泪中。。

折腾的最终结果就是CentOS 7 升级到CentOS 8失败了,release显示已经升级成功,但是内核版本升级失败,处理各种报错的过程中误删除了openssl包,导致系统无法登录,系统变砖。

查到也有类似升级失败的案例,也是因为没有官方支持,给出的建议是重新安装CentOS8,而不是从CentOS7升级。

总之用了多年的CentOS也算是走到了暮年,尽快寻找替换的操作系统吧。

最后无法忍受也不想再瞎折腾CentOS耽误时间了,直接重做了操作系统到Debian12,新鲜出炉(2024-07-15),看看人家内核版本:6.1.0-23

#centos停服##Debian# #k8s#k8s#

标签: #dnf为什么youarethebest