In this article, you will learn how to upgrade CentOS 7 to CentOS 8. The steps described herein do not depict the official upgrade and this should not be applied to a production server yet.
Step 1: Install the EPEL Repository
To start off, install the EPL repository by running:
# yum install epel-release -y

Step 2: Install yum-utils Tools
After successfully installing EPEL, install yum-utils by running the command below.
# yum install yum-utils

Thereafter, you need to resolves RPM packages by executing the command.
# yum install rpmconf # rpmconf -a

Next, perform a clean-up of all the packages you don’t require.
# package-cleanup --leaves # package-cleanup --orphans

Step 3: Install the dnf in CentOS 7
Now install dnf package manager which is the default package manager for CentOS 8.
# yum install dnf

You also need to remove the yum package manager using the command.
# dnf -y remove yum yum-metadata-parser # rm -Rf /etc/yum

Step 4: Upgrading CentOS 7 to CentOS 8
We are now ready to upgrade CentOS 7 to CentOS 8, but before we do so, upgrade the system using the newly install dnf package manager.
# dnf upgrade

Next, install CentOS 8 release package using dnf as shown below. This will take a while.
# 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
Next, upgrade the EPEL repository.
dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

After successfully upgrading the EPEL repository, remove all the temporary files.
# dnf clean all
Remove the old kernel core for CentOS 7.
# rpm -e `rpm -q kernel`
Next, be sure to remove conflicting packages.
# rpm -e --nodeps sysvinit-tools
Thereafter, launch the CentOS 8 system upgrade as shown.
# dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync

Step 5: Install the New Kernel Core for CentOS 8
To install a new kernel for CentOS 8, run the command.
# dnf -y install kernel-core

Finally, install CentOS 8 minimal package.
# dnf -y groupupdate "Core" "Minimal Install"
Now you can check the version of CentOS installed by running.
# cat /etc/redhat-release

Read Also: How to Set Up Automatic Updates for CentOS 8
Conclusion
This article concludes on how you can upgrade from CentOS 7 to CentOS 8. We hope you found this insightful.
Had to add “–allowerasing” to make mine work?
Also, change “upgrade” to “install“.
I had the same problem and found a workaround:
disable AppStream repo
enable AppStream repo
Thanks for the fix here is the command I used to get it to work:
After the installation, I also ran:
Everything looks good after the reboot now, thanks again.
I have upgraded centos 7.9 to centos 8.3.2011,
but it is still showing old kernel version.
Alfista – You may see a section like “weak dependencies” that includes some of the packages that require these dependencies. Python3 and Perl stuff has to be removed.
Hope to see the same guide for an upgrade from CentOS 7 to Rocky Linux 8 when will be available, this will save a lot of work in migration
@Luca,
Sure, once Rocky Linux 8 available, if instructions are there to upgrade from CentOS to Rocky Linux, will surely publish the guide on same..
Hi,
I have a problem with transaction check:
Running transaction check
Error: transaction check vs depsolve:
(gcc >= 8 with gcc < 9) is needed by annobin-9.23-1.el8.x86_64
rpmlib(RichDependencies) = 3:10.3.27 if mariadb) is needed by mariadb-connector-c-3.1.11-2.el8_3.x86_64
(mariadb-connector-c-config = 3.1.11-2.el8_3 if mariadb-connector-c-config) is needed by mariadb-connector-c-3.1.11-2.el8_3.x86_64
rpmlib(RichDependencies) <= 4.12.0-1 is needed by mariadb-connector-c-3.1.11-2.el8_3.x86_64
(annobin if gcc) is needed by redhat-rpm-config-123-1.el8.noarch
rpmlib(RichDependencies) <= 4.12.0-1 is needed by redhat-rpm-config-123-1.el8.noarch
To diagnose the problem, try running: 'rpm -Va –nofiles –nodigest'.
You probably have corrupted RPMDB, running 'rpm –rebuilddb' might fix the issue.
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Please can you help me?
Thanks.
Delete mariadb then run upgrade again.
Will, it does not delete all repositories? While I have follower one solution here on the net and the result was deleting all repositories and then I needed to add it manually and it was hard to get and install it back.
Thanks.