How to Upgrade Centos 7 to 8

On this page

  1. CentOS 7 to 8 Upgrade

CentOS 8 has been released on Sep 23rd, 2019 ISO's are available on the official website and could be installed in many ways, unfortunately, the minimal version is not available yet (or at all) as a SysAdmin it was my favorite build about 800 Mb compared to 6 Go, in this tutorial I will show you how to upgrade from Centos 7 to Centos 8

Please consider that this is not an official upgrade so it's not suitable for a production environment.

CentOS 7 to 8 Upgrade

Download and install EPEL repository:

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

Install yum-utils:

yum -y install rpmconf yum-utils

Resolving rpm packages:

rpmconf -a

result:

Result of rpmconf command

Keep Default.

Cleanup packages we don't need.

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

result:

Package cleanup

Install an RPM-based software DNF package manager :

yum -y install dnf

 

Removing yum package manager:

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

Updating a system with DNF:

sudo dnf -y upgrade

Installing the new version:

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

Upgrading EPEL repository:

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

Cleaning full temporary files kept on the repository

dnf clean all

removing kernels

rpm -e `rpm -q kernel`

Removing conflicting

rpm -e --nodeps sysvinit-tools

Now we launch the upgrade

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

Processing new configuration:

rpmconf -a

Confirm that new kernel-core is properly installed:

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

Confirm that grub is updated and in the right place

ROOTDEV=`ls /dev/*da|head -1`;
echo "Detected root as $ROOTDEV..."
grub2-install $ROOTDEV

Install Minimal package:

dnf -y groupupdate "Core" "Minimal Install"

Check Centos version:

cat /etc/centos-release

CentOS Upgraded successfully

CentOS Boot screen

Share this page:

Suggested articles

21 Comment(s)

Add comment

Comments

By: Chucho at: 2019-11-10 08:19:37

[[email protected] osboxes]# dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync --skip-brokenLast metadata expiration check: 0:07:38 ago on Sun 10 Nov 2019 03:09:39 AM EST.Error:  Problem: The operation would result in removing the following protected packages: kernel[[email protected] osboxes]#

By: AmineYC at: 2019-11-12 15:17:06

Hi Chucho, I did a test and it still works for me (regarding links), maybe you miss a step.

the error message is: Removing the protected package which is KERNEL. did you run: rpm -e `rpm -q kernel`, to install the new one after upgrading.

and: 

rpm -e `rpm -q kernel`

dnf -y install kernel-core

to install the new one?

Hope this will help you.

By: Terry Spearman at: 2019-11-12 21:18:30

Other websites I've seen regarding upgrading Centos 7 to Centos 8 have said that there probably never will be an upgrade utility and the only way to upgrade is to do a clean install of Centos 8.  This looks like a much better option, but I'm reluctant to try it in case it goes wrong.  I'd be extremely interested to learn if others have tried the method described here and what their experience with it has been.

By: Chucho linux at: 2019-11-13 03:22:07

[SKIPPED] yelp-xsl-3.28.0-2.el8.noarch.rpm: Already downloaded                                                     [SKIPPED] zenity-3.28.1-1.el8.x86_64.rpm: Already downloaded                                                       Running transaction checkError: transaction check vs depsolve:(annobin if gcc) is needed by redhat-rpm-config-116-1.el8.0.1.noarchrpmlib(RichDependencies) <= 4.12.0-1 is needed by redhat-rpm-config-116-1.el8.0.1.noarchTo 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'.

By: Carsten at: 2019-11-14 09:14:58

same for me:

dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync ->> your error (german so i wont post the text) apart from that the upgrade seems to be working, /etc/redhead-release changed from 

CentOS Linux release 7.7.1908 (Core)

to

CentOS Linux release 8.0.1905 (Core)

 

By: stafwag at: 2019-12-21 18:53:12

I had the same issue. To resolve it I ended up removing gcc and all devel packages

#rpm -qa | grep -i devel | xargs -n 1 dnf remove -y

Still needed to remove some other packages, but after that the upgrade was fine...

By: Amr at: 2020-03-07 16:42:56

You are a life saver, thank you!

By: George at: 2019-11-15 00:59:31

Thanks, worked perfectly! A bit scary to do on a remote machine, but it quickly came up again after reboot :)

By: DrMartinus at: 2019-11-15 15:55:21

I tend to do the upgrade, because I do not know how to make sure that all data and configuration is secured and can be replayed without a lot of trouble. If it really ends up in setting everything up from scratch (because CentOS doesn't support an upgrade but requires a new installation), that would be awful. For now, I keep CentOS 7 and hope that some more people report success here, before I go ahead.

Unfortunately, my vserver-provider didn't allow the installation of a rolling release, else I would have chosen that when setting up the system.

By: perolator at: 2019-12-03 01:52:34

Upgrade was successful. Run the steps and worked.

[[email protected] ~]# cat /etc/centos-releaseCentOS Linux release 8.0.1905 (Core)

 

By: Jobst at: 2019-12-09 23:41:05

Can I ask the people who have done the upgrade what the release version was BEFORE update, please?I have heard that beginning 7.7 this is NOT possible anymore. Also have people done this on production systems?

By: SquirelMonkeyRock at: 2019-12-23 21:28:02

I received a bunch of errors about kernel being a protected kernel when trying to remove the old kernel. Regardless of the errors I went throught the steps and see  Centos 8 when running cat /etc/centos-releaseCentOS however uname -r shows a 3.10 kernel version.

By: rsherman at: 2020-01-07 23:16:04

have fun with your zombie systems!

By: Tuan ng at: 2020-01-26 12:59:29

thanks, but it doesnt work at the moment the new release is this one on bytemark.co.uk: centos-release-8.1-1.1911.0.8.el8.x86_64.rpm . The upgrade just stop at "dnf -y upgrade"

[[email protected] ~]# cat /etc/centos-release CentOS Linux release 7.7.1908 (Core)

[[email protected] ~]# dnf -y upgrade http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.1-1.1911.0.8.el8.x86_64.rpm Last metadata expiration check: 1:33:06 ago on Sun 26 Jan 2020 12:15:03 PM CET. centos-release-8.1-1.1911.0.8.el8.x86_64.rpm 78 kB/s | 21 kB 00:00 Dependencies resolved.

Problem: cannot install the best update candidate for package centos-release-7-7.1908.0.el7.centos.x86_64 – nothing provides centos-gpg-keys = 8.1-1.1911.0.8.el8 needed by centos-release-8.1-1.1911.0.8.el8.x86_64 – nothing provides centos-repos = 8.1-1.1911.0.8.el8 needed by centos-release-8.1-1.1911.0.8.el8.x86_64 ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Skipping packages with broken dependencies: centos-release x86_64 8.1-1.1911.0.8.el8 @commandline 21 k

Transaction Summary ======================================================================================================================================================================== Skip 1 Package

Nothing to do. Complete! [[email protected] ~]# [[email protected] ~]#

I try:

 

[[email protected] ~]# rpm -ivh http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm Retrieving http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm warning: /var/tmp/rpm-tmp.futBz3: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY error: Failed dependencies: centos-release < 8.0-0.1905.0.10 conflicts with centos-gpg-keys-8.1-1.1911.0.8.el8.noarch [[email protected] ~]#

By: Dmitry at: 2020-02-27 11:35:35

Use this link http://mirror.bytemark.co.uk/centos/8.0.1905/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm

By: Jason at: 2020-04-24 12:08:48

Even better is to use centos vault. That never changes. Mirrors are not guaranteed to keep previous releases.

http://vault.centos.org/8.0.1905/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm

By: Edson at: 2020-05-14 12:03:20

Thanks, This one works for me

By: dM at: 2020-02-09 21:27:22

Hi, this is not working.My kernel is: 3.10.0-1062.12.1.el7.x86_64CentOS Linux release 7.7.1908 (Core)

[[email protected] ~]# rpm -e `rpm -q kernel`

error: package package is not installed

error: package kernel is not installed

error: package is is not installed

error: package not is not installed

error: package installed is not installed

[[email protected] ~]# dnf -y install kernel-core

Failed to set locale, defaulting to C

Last metadata expiration check: 0:04:51 ago on Sun Feb  9 22:18:31 2020.

No match for argument: kernel-core

Error: Unable to find a match: kernel-core

By: Duilio at: 2020-03-28 23:23:55

 I'm trying to upgrade centos, but I'm having problems after# dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-syncError: transaction check vs depsolve:(gcc >= 8 with gcc < 9) is needed by annobin-8.78-1.el8.x86_64rpmlib(RichDependencies) <= 4.12.0-1 is needed by annobin-8.78-1.el8.x86_64(annobin if gcc) is needed by redhat-rpm-config-120-1.el8.noarchrpmlib(RichDependencies) <= 4.12.0-1 is needed by redhat-rpm-config-120-1.el8.noarchTo diagnose the problem, try running: 'rpm -Va --nofiles --nodigest'.I tried : # dnf remove redhat-rpm-configand also removed the package with issues in #  rpm -Va --nofiles --nodigestand after that I did # rpm --rebuilddbBut, same problem.Tried:   # dnf clean packagesTried again # dnf remove redhat-rpm-config     and got:   No match for argument: redhat-rpm-config   No packages marked for removal.  Tried also  # dnf remove redhat-rpm-config-120-1.el8.noarchbut still same problem.Any help for what is the problem ?

By: Hussain at: 2020-04-02 07:55:52

At the step "dnf -y upgrade http://mirror.bytemark.co.uk/...", I get a 404. This is becuase the release numbers keep getting updated and previous files are removed.

 

Go to http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/ and copy/paste the links for three packages instead:

centos-release, centos-repos, centos-gpg-keys

By: Fernando at: 2020-05-11 11:28:34

if error at dnf -y upgrade http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.1-1.1911.0.9.el8.x86_64.rpmProblem: cannot install the best update candidate for package centos-release-7-8.2003.0.el7.centos.x86_64- nothing provides centos-gpg-keys = 8.1-1.1911.0.9.el8 needed by centos-release-8.1-1.1911.0.9.el8.x86_64- nothing provides centos-repos = 8.1-1.1911.0.9.el8 needed by centos-release-8.1-1.1911.0.9.el8.x86_64then usednf upgrade -y http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/{centos-release-8.1-1.1911.0.8.el8.x86_64.rpm,centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm,centos-repos-8.1-1.1911.0.8.el8.x86_64.rpm}found at www centlinux com /2020/01/how-to-upgrade-centos-7-to-8-server.html