DEV Community

Cover image for Centos 7 to 8 Upgrade
Syamkumar
Syamkumar

Posted on

Centos 7 to 8 Upgrade

Alt Text

Red Hat Enterprise Linux 8 was released on 2019-05-07, and everyone is waiting to find out when the CentOS rebuild will occur. This document is meant to cover general questions and a timeline for what is happening.

A CentOS major release takes a lot of planning and changes in tooling as it is based on a much newer version of Fedora than previous versions. This means that everything from the installer, packages, packaging, and build systems need major overhauls to work with the newer OS. This means that there is always a ramp-up period depending on the changes needed to make a rebuild work. The differences between EL-8 and EL-7 are no exception as the kernel has changed drastically, the repository format has added 'modules' and RPMS has grown many features that EL7 and before do not have. About the only item which has not drastically changed between EL7 and EL8 is the init system which is still system.

To upgrade centos 7 to centos 8

Login as sudo sudo --login

Steps :

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

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
Enter fullscreen mode Exit fullscreen mode
  • install a new kernel for CentOS 8
dnf -y install kernel-core
Enter fullscreen mode Exit fullscreen mode
  • install CentOS 8 minimal package
dnf -y groupupdate "Core" "Minimal Install"
Enter fullscreen mode Exit fullscreen mode
  • check the version of CentOS installed by running.
cat /etc/redhat-release
Enter fullscreen mode Exit fullscreen mode

You have complete Centos Upgrade

Discussion (0)