@CentOS 7 升级至CentOS 8(linux系统跨版本系统升级)


在这里插入图片描述

1|0CentOS 7.9升级到CentOS 8.5 解决方案

2|01.准备一台CentOS 7版本服务器

#查看系统 [root@test ~]# uname Linux #查看当前版本 [root@test ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) #查看版本内核 [root@test ~]# uname -r 3.10.0-693.el7.x86_64

3|02.准备epel仓库

#安装epel仓库 [root@test ~]# yum install epel-release -y #安装yum工具(默认为yum工具) [root@test ~]# yum install yum-utils

4|03.安装rpmconf软件包

#安装rmp解析配置工具包 [root@test ~]# yum -y install rpmconf #配置为软件维护的版本,保留rpm默认配置,输入y即可 [root@test ~]# rpmconf -a Configuration file '/etc/nsswitch.conf' -rw-r--r--. 1 root root 1938 Apr 28 2021 /etc/nsswitch.conf.rpmnew -rw-r--r--. 1 root root 1746 Oct 2 2021 /etc/nsswitch.conf ...... ...

5|03.Centos 软件包清理

#清理所有无用软件包 [root@test ~]# package-cleanup --leaves Loaded plugins: fastestmirror libsysfs-2.1.0-16.el7.x86_64 zlib-devel-1.2.7-19.el7_9.x86_64 #清理RPM软件包 [root@test ~]# package-cleanup --orphans Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.bfsu.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com ..... ...

6|04.安装Centos 8默认软件管理器dnf

#当前系统中安装dnf软件包管理工具(centos 8默认使用) [root@test ~]# yum install dnf Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile ... .. #检查确认dnf软件管理工具 [root@test ~]# dnf --version #出现以下报错(不是dnf安装失败,主要是版本太低,不兼容,需要更新python版本) Traceback (most recent call last): File "/usr/bin/dnf", line 57, in <module> from dnf.cli import main File "/usr/lib/python2.7/site-packages/dnf/__init__.py", line 30, in <module> ....... ... #更新dnf管理工具依赖包 [root@test ~]# yum update python* #为了防止出现别的问题,安装dnf所关联的软件工具 [root@test ~]# yum install dnf-data dnf-plugins-core libdnf-devel libdnf python2-dnf-plugin-migrate dnf-automatic -y #检查dnf软件管理工具是否正常(以下状态表示dnf就可以正常使用) [root@test ~]# dnf --version 4.0.9 Installed: dnf-0:4.0.9.2-2.el7_9.noarch at Tue 07 Jun 2022 01:31:12 PM CST Built : CentOS BuildSystem <http://bugs.centos.org> at Wed 07 Apr 2021 03:52:38 PM CST Installed: rpm-0:4.11.3-48.el7_9.x86_64 at Tue 07 Jun 2022 01:18:49 PM CST Built : CentOS BuildSystem <http://bugs.centos.org> at Wed 24 Nov 2021 04:33:39 PM CST

7|05.卸载Centos 7默认软件管理器yum

#卸载centos 7中yum软件管理工具(使用dnf卸载 centos 7默认软件管理工具yum) [root@test ~]# dnf -y remove yum yum-metadata-parser #删除yum相关配置文件 [root@test ~]# rm -Rf /etc/yum

8|06.系统更新

#CentOS 7升级到CentOS 8

【linux下载官方链接】
【centos官方下载】

#centos 7系统升级(使用新安装的dnf软件管理) [root@test ~]# dnf upgrade -y

9|07.系统升级(centos 7升级 centos 8)

#dnf安装CentOS 8发行软件包(基本所有仓库Centos 8软件包均已删除) [root@test ~]# dnf -y upgrade https://mirrors.bfsu.edu.cn/centos/8-stream/BaseOS/x86_64/os/Packages/centos-stream-release-8.5-3.el8.noarch.rpm [root@test ~]# dnf install https://mirrors.aliyun.com/centos/8/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} #升级epel仓库源 [root@test ~]# dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-8.noarch.rpm [root@test ~]# dnf -y upgrade https://mirrors.bfsu.edu.cn/epel/epel-release-latest-8.noarch.rpm #清空所有缓存 [root@test ~]# dnf clean all #删除 centos 7内核包 [root@test ~]# rpm -e `rpm -q kernel` #出现报错(一般为软件包不兼容或者软件包冲突导致,可根据以下方式卸载即可) #卸载冲突的软件包 [root@test ~]# rpm -e --nodeps sysvinit-tools #启动CentOS 8系统升级 [root@test ~]# dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync #安装适用的centos 8内核 [root@test ~]# dnf -y install kernel-core #min化安装centos 8软件包 [root@test ~]# dnf -y groupupdate "Core" "Minimal Install" #出现错误(centos8.0 软件仓库报错) #删除原来的阿里软件仓库 [root@test ~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo #下载华为centos8版本的软件仓库 [root@test ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo #清理仓库缓存 [root@test ~]# dnf clean all #重新生成缓存并查看仓库(确认仓库是否正常) [root@test ~]# dnf repolist #仓库修改完成后,继续安装min [root@test ~]# dnf groupupdate "Core" "Minimal Install" --allowerasing [root@test ~]# dnf groupupdate "Core" "Minimal Install" --skip-broken [root@test ~]# rpm -Va --nofiles --nodigest [root@test ~]# rpm --rebuilddb [root@test ~]# dnf clean packages #查看当前的系统版本(已经升级为centos 8.5) [root@test ~]# cat /etc/redhat-release CentOS Linux release 8.5.2111

10|08.升级后系统测试

#安装nginx(安装成功表示升级没有问题) [root@test ~]# dnf install nginx

__EOF__

本文作者ଲ小何才露煎煎饺
本文链接https://www.cnblogs.com/zeny/p/16578221.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   ଲ小何才露煎煎饺  阅读(4467)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2021-08-11 @kuberbetes(k8s)集群图形化kuboard安装及使用
点击右上角即可分享
微信分享提示