系统相关
首页 > 系统相关> > centos7升级centos8

centos7升级centos8

作者:互联网

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.

标签:升级,dnf,kernel,centos7,upgrade,yum,stuff,rpm,centos8
来源: https://blog.csdn.net/Pangshibo233/article/details/102740475