Rocky version upgrade instructions (8 -> 9)

Running these commands could break your system, remember to create backups!

 

First update system package repository:

sudo dnf upgrade --refresh

 

Then add new version repositories:

REPO_URL="https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r"
RELEASE_PKG="rocky-release-9.2-1.6.el9.noarch.rpm"
REPOS_PKG="rocky-repos-9.2-1.6.el9.noarch.rpm"
GPG_KEYS_PKG="rocky-gpg-keys-9.2-1.6.el9.noarch.rpm"
sudo dnf install $REPO_URL/$RELEASE_PKG $REPO_URL/$REPOS_PKG $REPO_URL/$GPG_KEYS_PKG

 

Remove useless packages:

sudo dnf -y remove rpmconf yum-utils epel-release
sudo rm -rf /usr/share/redhat-logos

 

Install new version packages:

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

 

If you didn't get errors with the GPG-Keys you can skip this section


Show the key ID:

rpm -qa gpg*

 

Remove the existing key:

sudo rpm -e --allmatches gpg-pubkey-[KEY ID HERE]

 

Isntall a new key:

sudo rpm --import https://dl.rockylinux.org/pub/rocky/RPM-GPG-KEY-Rocky-9

 

Install new version packages again.


 

Rebuild the rpm database:

sudo rpm --rebuilddb

 

Reboot:

sudo reboot

 

Rocky should now be upgraded.

Check the version:

cat /etc/os-release

Was this answer helpful? 4 Users Found This Useful (8 Votes)