centos7 升级到 centos8

安装必要包

1
yum install yum-utils epel-release -y
1
yum install rpmconf -y

升级

1
rpmconf -a

输出空

1
package-cleanup --leaves
1
yum install dnf -y

清除

1
yum dnf -y remove yum yum-metadata-parser && rm -rf /etc/yum
1
wget http://mirrors.ustc.edu.cn/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-3.el8.noarch.rpm wget http://mirrors.ustc.edu.cn/centos/8/BaseOS/x86_64/os/Packages/centos-linux-release-8.5-1.2111.el8.noarch.rpm wget http://mirrors.ustc.edu.cn/centos/8/BaseOS/x86_64/os/Packages/centos-linux-repos-8-3.el8.noarch.rpm dnf install -y centos-gpg-keys-8-3.el8.noarch.rpm centos-linux-release-8.5-1.2111.el8.noarch.rpm centos-linux-repos-8-3.el8.noarch.rpm
1
dnf clean all
1
rpm -e --nodeps rpm -qa|grep -i kernel
1
rpm -e --nodeps sysvinit-tools
1
dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync 

按照需要xxx的包

1
rpm -ivh --nodeps --force http://mirrors.ustc.edu.cn/centos/8/BaseOS/x86_64/os/Packages/dracut-network-049-191.git20210920.el8.x86_64.rpm 
1
rpm -ivh --nodeps --force http://mirrors.ustc.edu.cn/centos/8/AppStream/x86_64/os/Packages/flatpak-1.8.5-5.el8_5.x86_64.rpm

卸载事务检查错误的包

1
rpm -e --nodeps man-pages-zh-CN-1.5.2-4.el7

再次运行

1
dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync
1
cat /etc/redhat-release 
1
dnf clean all

安装内核

1
dnf -y install kernel-core --best --allowerasing
1
dnf clean packages
1
2
3
dnf -y groupupdate "Core" "Minimal Install" --allowerasing

reboot

设置启动顺序

1
grub2-set-default 0