Upgrade CentOS7 to CentOS8

Note. NO MORE WORKING!

Note: You’ll need to have Elrepo enabled due deprecated raid dirvers. Be sure Elrepo is enabled!

⚠️ NOTE: This article gives no warranty and accepts no responsibility for breaking your production/super-important machine, proceed at your own risk.

yum update

yum upgrade

Steps :

  • Install Epel release package
yum install epel-release -y
  • Install yum utils
yum install yum-utils -y
  • Resolve RPM packages by executing the command.
yum install rpmconf -y
rpmconf -a
  • Perform a clean-up of all the packages you don’t require.
 package-cleanup --leaves
 package-cleanup --orphans
  • Install DNF package manager since Centos 8 uses DNF instead of yum
yum install dnf -y 
  • Remove yum package manager which was part of centos 7
dnf -y remove yum yum-metadata-parser 
rm -Rf /etc/yum
  • Run dnf upgrade -y
  • install CentOS 8 release package
dnf install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-repos-8.2-2.2004.0.1.el8.x86_64.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.2-2.2004.0.1.el8.x86_64.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.2-2.2004.0.1.el8.noarch.rpm
  • upgrade the EPEL repository.
dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
  • remove all the temporary files.
dnf clean all 
  • Remove the old kernel core for CentOS 7.
 rpm -e `rpm -q kernel` 
  • to remove conflicting packages.
rpm -e --nodeps sysvinit-tools 
  • launch the CentOS 8 system upgrade
 dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync 

Troubleshooting for common errors during this step.

  • Python 3 dependency error. fix by

dnf remove python3

  • Segmentation fault
rm -rf /var/lib/rpm/__db.*
rpm --rebuilddb
dnf clean all
dnf makecache
  • install a new kernel for CentOS 8
dnf -y install kernel-core
  • install CentOS 8 minimal package
dnf -y groupupdate "Core" "Minimal Install"
  • check the version of CentOS installed by running.
cat /etc/redhat-release

You have complete Centos Upgrade

 

===

Apendix (version 2)

Now we need to install the new repositories, for CentOS 8

Updated with the newest repository RPMs, the old one has been deleted.

dnf install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-repos-8-2.el8.noarch.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-release-8.3-1.2011.el8.noarch.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-2.el8.noarch.rpm -y

Remember those extra packages we installed earlier?

Good, let’s update them too

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

Installing, upgrading and deleting packages might leave some dirt somewhere, better clean everything before upgrade

dnf clean all

Now we need to remove the old Kernels for CentOS 7, we’re not going to need them anyore

rpm -e `rpm -q kernel`

Along with old Kernels, we need to clean any conflicting packages

rpm -e --nodeps sysvinit-tools

Finally we’re ready to launch the upgrade!

Let’s go

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

After quite a bit, depending on your hardware, the process should exit giving you the prompt back

All we need now is to update or install some things…

Let’s start by installing the new Kernel for CentOS 8

dnf install kernel-core -y

Almot there, one thing’s left is to install the Core and Minimal packages

dnf groupupdate "Core" "Minimal Install" -y

Finsh!

Let’s check our O.S. Version

cat /etc/redhat-release

It should return something similar to this

CentOS Linux release 8.3.2011

===============

Apendix 3 – full version of 2

First of all, we need to update or system

yum update -y

Now, before going knee deep into our upgrade, we need to install some extra packages

Let’s start with adding its repository

yum install epel-release -y

And now install the extra utilities

yum install yum-utils

Now’s time to clean all those orphan packages we built up during the life of our System (if any)

package-cleanup --leaves

package-cleanup --orphans

Thi distro will use a new package manager, YUM reachedthe end of its life (sigh…) and it’s going to get replaced by DNF

In order to achive this, first of all, we need to install DNF

yum install dnf -y

And then remove our beloved YUM

dnf remove yum yum-metadata-parser -y

Lets also clean its directory

rm -Rf /etc/yum

What we need to do now, is upgrade the system with DNF, to download any new package YUM left behind

dnf upgrade -y

Now we need to install the new repositories, for CentOS 8

Updated with the newest repository RPMs, the old one has been deleted.

dnf install http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-repos-8-2.el8.noarch.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-release-8.3-1.2011.el8.noarch.rpm http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-2.el8.noarch.rpm -y

Remember those extra packages we installed earlier?

Good, let’s update them too

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

Installing, upgrading and deleting packages might leave some dirt somewhere, better clean everything before upgrade

dnf clean all

Now we need to remove the old Kernels for CentOS 7, we’re not going to need them anyore

rpm -e `rpm -q kernel`

Along with old Kernels, we need to clean any conflicting packages

rpm -e --nodeps sysvinit-tools

Finally we’re ready to launch the upgrade!

Let’s go

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

After quite a bit, depending on your hardware, the process should exit giving you the prompt back

All we need now is to update or install some things…

Let’s start by installing the new Kernel for CentOS 8

dnf install kernel-core -y

Almot there, one thing’s left is to install the Core and Minimal packages

dnf groupupdate "Core" "Minimal Install" -y

Finsh!

Let’s check our O.S. Version

cat /etc/redhat-release

It should return something similar to this

CentOS Linux release 8.3.2011