This Blog describes the Migration from CentOS 8 to Rocky Linux 8.
And hopefully there is a backup or VM Snapshot in place when something goes wrong.

At first Updating CentOS 8 to the latest is required, but this is now not so easy, most Repositiory Mirrors are deprecated.
As Preparation an adaptation of the CentOS Repo files is needed to get this task done.

In this case the following repo files where in place, CentOS-AppStream.repo, CentOS-Base.repo, CentOS-Extras.repo, CentOS-PowerTools.repo.
So a adaptation of the baseurl in these four files is required.

$ CentOS-AppStream.repo
$ baseurl=$contentdir/$releasever/AppStream/$basearch/os/
$ CentOS-Base.repo
$ baseurl=$contentdir/$releasever/BaseOS/$basearch/os/
$ CentOS-Extras.repo
$ baseurl=$contentdir/$releasever/extras/$basearch/os//
$ CentOS-PowerTools.repo
$ baseurl=$contentdir/$releasever/PowerTools/$basearch/os/

The repositories at working, most other as I wrote are deprecated and not reachable.

After the adaptation of the repo file update CentOS 8 to 8.5.

$ dnf update

And reboot afterwards.
If possible create after the CentOS 8.5 upgrade a backup or snapshot.

The CentOS repo files renamed to repo.rpmsave and there will be new ones named CentOS-Linux.. now.

Rocky Linux provides a migration script which ca be downloaded using curl.

$ cd /tmp
$ mkdir rocky
$ cd rocky
$ curl -o
$ chmod u+x

This scrip know three switches, -h for help, -r for run and -V for verify.
For the migration we need -r.

$ ./ -r

There will be an error message about invalid URLs, this is related to CentOS so it can be ignored.
This script will replace the CentOS packages with the Rocky Linux ones, so it will run a while.
When it has finished successfully and the system was rebootet the migration is done.

# cat /etc/os-release
$ NAME="Rocky Linux"
$ VERSION="8.5 (Green Obsidian)"
$ ID="rocky"
$ ID_LIKE="rhel centos fedora"
$ VERSION_ID="8.5"
$ PLATFORM_ID="platform:el8"
$ PRETTY_NAME="Rocky Linux 8.5 (Green Obsidian)"
$ ANSI_COLOR="0;32"
$ CPE_NAME="cpe:/o:rocky:rocky:8:GA"