How to Upgrade from CentOS 7 to CentOS 8
This tutorial describe how to upgrade from CentOS 7.9 to CentOS 8.2.
Things to be consider while performing the upgrade from CentOS 7.9 to CentOS8.2 👇👇👇
– Always do full backup your system before upgrade
– Actual scenario might have different situation
– Make sure, all the configured repositories should be updated and able to update package for CentOS 8
– This is an unofficial, unsupported procedure !
Here are the commands for upgrade from CentOS 7.9 to CentOS 8.2 👇👇👇
# Install the EPEL Repository, if it is not configured
yum install epel-release -y
# Install yum-utils Tools
yum install yum-utils -y
# Resolves RPM packages
yum install rpmconf -y
rpmconf -a
# Perform a clean-up of all the packages which don’t require
package-cleanup –leaves; package-cleanup –orphans
# Install dnf package in CentOS7
yum install dnf -y
# Remove yum package manager
dnf -y remove yum yum-metadata-parser
rm -Rf /etc/yum
# Upgrading CentOS7 using dnf
dnf upgrade -y
# Install CentOS 8 Release package (centos-linux-repos, centos-linux-release, centos-gpg-keys)
dnf install -y https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-repos-8-2.el8.noarch.rpm https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-release-8.3-1.2011.el8.noarch.rpm https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-2.el8.noarch.rpm
# Adjusting CentOS-Linux-BaseOS Repo to avoid any error
mv /etc/yum.repos.d/CentOS-Linux-BaseOS.repo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo.original
vi /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
[baseos]
name=CentOS Linux $releasever – BaseOS
baseurl=https://vault.centos.org/8.2.2004/BaseOS/x86_64/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
# Upgrade EPEL and Remi Repository
dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm https://rpms.remirepo.net/enterprise/remi-release-8.rpm
# Removing all temporary package files
dnf clean all
# Removing old Kernel code of CentOS 7
rpm -e `rpm -q kernel`; rpm -e –nodeps sysvinit-tools
# CentOS8 system upgrade
dnf -y –releasever=8 –allowerasing –setopt=deltarpm=false distro-sync
# Install new Kernel Core for CentOS 8
dnf -y install kernel-core kernel
# Install CentOS 8 Minimum Package
dnf -y groupupdate “Core” “Minimal Install”
# Optionally, install Server with GUI with following command
# dnf -y groupupdate “Server with GUI” “Server”
# Install grub2, if does not installed
dnf install grub2 -y
# Install GRUB into MBR
lsblk
# Install GRUB in the device displayed from above command.
grub2-install /dev/sda
# Make GRUB Configuration file
grub2-mkconfig -o /boot/grub/grub.cfg
# reboot the system to start the system into CentOS 8
reboot
# View the current version
cat /etc/centos-release
centos 7