centos7升级centos8

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/Pangshibo233/article/details/102740475

centos7升级centos8(亲测好用)

#Centos 7 => 8 manual upgrade.
#No support is given, YMMV, remember backups!
#Tested with upcloud and cloudatcost.

Get ready to upgrade

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install rpmconf yum-utils

Resolve all config stuff.

rpmconf -a

Packages you might not need/require, remove if something doens’t seem to be required.

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

Install DNF.

yum -y install dnf

Remove yum

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

Upgrade system to be up-to-date

dnf -y upgrade

Install new versions:

dnf -y upgrade http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm

Upgrade EPEL

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

Dnf clean

dnf clean all

Remove kernels, kernel packages are kernel-core in c8.

rpm -e 'rpm -q kernel'

Remove definitely conflicting stuff.

rpm -e --nodeps sysvinit-tools

Try to run the upgrade

dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync

If it doesn’t succeed (YMMV), fix dependency stuff by removing/installing conficting stuff and try again.
eg. if you want to drop all the dependencies

#dnf remove python2-six python-six
#eg. you don’t want to drop all the dependencies, they would remove too much.
#rpm -e --nodeps sysvinit-tools

Process new configs

rpmconf -a

Ensure kernel is properly installed

rpm -e kernel-core
dnf -y install kernel-core

Make sure grub is updated (ensure that it’s right place!)

ROOTDEV='ls /dev/*da|head -1';
echo “Detected root as $ROOTDEV…”
grub2-install $ROOTDEV

Install new stuff that is in the Core/Minimum Install:

dnf -y groupupdate “Core” “Minimal Install”

Install back the stuff that you need and removed to get the dnf distro-sync to succeed.

猜你喜欢

转载自blog.csdn.net/Pangshibo233/article/details/102740475