Hostwinds Tutorials

Search results for:


Table of Contents


Cleaning Up CentOS 7
Replacing Packages
Install the New Kernel and Release

Upgrading from CentOS 7 to 8

Cleaning Up CentOS 7
Replacing Packages
Install the New Kernel and Release

As new versions of the software are released, you may be looking to update your installation to receive all of the latest and greatest features the new version offers. The same can also apply to your server's operating system.

Since a new version of the popular Linux-based operating system, CentOS, has been released, you may be wanting to look into upgrading your server to this new version.

In Hostwinds' Cloud infrastructure, we do have a pre-made CentOS 8 image that you can use to reinstall a server easily. However, that option reinstalls the entire operating system of the server, meaning that any data on the server would be lost.

If you want to upgrade from CentOS 7 to 8 without needing to backup and restore your data, the upgrade must be done manually. This guide will go over the process to get your CentOS 7 server directly upgraded to CentOS 8.

You will need to perform all the following steps from your server's terminal, which you can access by connecting to your server via SSH. Once connected, follow the following sections to perform the upgrade.

It is highly recommended to take a snapshot of your VPS before attempting this upgrade, just if you need a backup of your server that can be easily restored.

Cleaning Up CentOS 7

Before installing CentOS 8, it is best to clean up your current system so that there are no leftover, unneeded, or conflicting packages.

To do this, first, make sure your system is up to date:

yum update -y

Next, make sure you have the epel-release repository installed:

yum install -y epel-release

Then install the yum-utils and rpmconf packages:

yum install -y yum-utils rpmconf

Now that rpmconf is installed, we will use it to resolve our rpm packages:

rpmconf -a

NOTE: if rpmconf detects that a new version of a configuration file is available from the package maintainer and asks if you want to install it, select the default option of 'N' to keep your currently installed version.

And finally, perform cleanup for any unneeded or orphaned packages:

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

Replacing Packages

The next steps in switching to CentOS 8 are replacing the essential system packages and repositories with their CentOS 8 equivalents.

First, install a new rpm-based package manager called DNF:

yum install -y dnf

Secondly, remove the yum package manager:

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

Next, run a system update with DNF:

dnf upgrade -y

Then install the CentOS 8 packages:

dnf install 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}

And upgrade the EPEL repository:

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

Finally, clean up all temporary files:

dnf clean all

Install the New Kernel and Release

The final steps in switching over to CentOS 8 are installing the new version of the Linux kernel and the new CentOS 8 release itself.

First, remove the old kernel:

rpm -e `rpm -q kernel`

Then remove any conflicting packages:

rpm -e --nodeps sysvinit-tools

Next, start the CentOS 8 upgrade:

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

Then install the new kernel core:

dnf -y install kernel-core

And run the CentOS 8 Minimal install:

dnf -y groupupdate "Core" "Minimal Install"

Now your server has been successfully upgraded to CentOS 8, and you can verify your OS's release version from the os-release and RedHat-release files:

cat /etc/os-release
cat /etc/redhat-release

Written by David Hamilton  /  March 24, 2020

Need help? Chat now!