centos7升级centos8

流过昼夜 提交于 2019-12-02 08:24:31

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.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!