Upgrading CentOS 7 to CentOS 8

CentOS is a Linux distribution based on and compatible with Red Hat’s commercial Red Hat Enterprise Linux. According to the Red Hat Enterprise Linux (RHEL) lifecycle, CentOS 5, 6, and 7 will be supported “up to 10 years” as they are based on RHEL. Previously, CentOS 4 was supported for seven years.

Training

Add EPEL repository

$ sudo yum -y install epel-release

Installing the yum-utils utility

$ sudo yum -y install yum-utils

Install rpmconf utility

$ sudo yum -y install rpmconf

We check and compare configs

$ sudo rpmconf -a

After executing the command, we look at the output of the utility and answer questions about which config we need (current, default from the package …)

We look at what packages we have installed not from the repositories, are there any packages in the system that can be removed

$ sudo package-cleanup --leaves
$ package-cleanup --orphans

Centos update to version 8

Install dnf package manager, which is used by default in CentOS 8

$ sudo yum -y install dnf

Remove package manager yum (if you don’t need it later)

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

Updating Centos

$ sudo dnf -y upgrade

Installing the required packages for CentOS 8

$ sudo dnf -y 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

Updating the EPEL repository

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

Removing temporary files

$ sudo dnf clean all

Removing old kernels from Centos 7

$ sudo rpm -e `rpm -q kernel`

Removing packages that may conflict

$ sudo rpm -e --nodeps sysvinit-tools

We start the system update

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

At this point I got a dependency error

python3-rpmconf-1.0.21-1.el8.noarch conflicts with file from package python36-rpmconf-1.0.22-1.el7.noarch

Decision:

$ sudo dnf -y remove python36-rpmconf

Kernel for Centos 8

Installing a new kernel for CentOS 8

$ sudo dnf -y install kernel-core

Installing the minimum set of packages through group management

$ sudo dnf -y groupupdate "Core" "Minimal Install"

Checking which version of centos is installed

$ cat /etc/*release
CentOS Linux release 8.2.2004 (Core) 
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

CentOS Linux release 8.2.2004 (Core) 
CentOS Linux release 8.2.2004 (Core) 

Removing temporary files

$ sudo dnf clean all

Error installing YUM

An error occurred during installation

[...]
Error: Transaction failed

Decision

$ cd /usr/bin
$ sudo ln -s dnf-3 yum
$ cd /etc/yum
$ sudo rm -r *
$ sudo dnf -y install yum

Sidebar