Upgrade your CentOS 8 or 7 to CentOS Stream (latest release)
As CentOS 8 has reached EOL on 31st December 2021, it is a good practice to migrate your VMs to CentOS Stream which is a midstream between Fedora and RHEL. If you are still on CentOS 7, then you can skip upgrading to CentOS 8 and directly upgrade to CentOS Stream which is the latest version.
#1 Update your CentOS
dnf update -y
#2 Check the OS Version
more /etc/redhat-release
#3 Update to latest release package
dnf install centos-release-stream -y --allowerasing
#4 Sync your installed packages to latest
dnf distro-sync -y --allowerasing
#5 Validate the version upgrade
more /etc/redhat-release