How to upgrade Rocky Linux from 8.5 to 9 using the CLI

Estimated read time 4 min read

[ad_1]

Jack Wallen takes you through the simple steps of upgrading Rocky Linux to the latest major release.

computer login 01
Image: ST.art/Adobe Stock

Rocky Linux has quickly become a darling of the open source industry, poised to help users and admins alike totally forget that CentOS ever lived on their servers and data centers. Rocky Linux is as fine a server OS as you’ll ever use and has all but been guaranteed that it will never go away.

But, like all operating systems, you’re going to need to upgrade. Why? Security patches, bug fixes and new features. I realize many admins are hesitant to migrate their production servers from one release to another and that’s an understandable proposition. After all, everything is working to perfection, so why would you want to risk it? As with any operating system, with major updates come major features.

SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)

For instance, Rocky Linux 9 ships with OpenSSL 3.0.1 and OpenSSH 8.7.01 and includes automatic configuration compliance settings for PCI-DSS, HIPAA and DISA. There’s also Node.js 16, Perl 5.32, PHP 8.0, Python 3.9 and Ruby 3.0. There are plenty of reasons to upgrade from 8.x to 8.

Believe it or not, this isn’t all that challenging. Let’s dive in and find out.

What you’ll need to update Rocky Linux

The only things you’ll need for this are a running instance of Rocky Linux 8.x and a user with sudo privileges. That’s all, folks. Time to work.

Back up, back up, back up

Before you do this, make sure to back up any important data on the server. You can do this with tar or any backup solution you use — just make sure you take care to store those backups on an external drive.

If tar is your solution of choice, you could simply back up everything minus non-data-containing directories with a single command. Say you have an external drive mounted to /data. You could back everything up with:

sudo tar czf /data/rocky_backup.tar.gz --exclude=/rocky8.tar.gz --exclude=/dev --exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/run --exclude=/tmp --exclude=/media --exclude=/lost+found /

Once you’re satisfied with the backup, time to upgrade.

How to upgrade Rocky Linux

The first thing you must do is upgrade all currently installed software with the command:

sudo dnf update

Once the upgrade finishes reboot the system.

Next, we need to add the Rocky Linux 9 repositories. We can do this by first setting a few variables to define package numbers with the following commands, making sure to check this site for the latest releases:

REPO_URL="https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r"

RELEASE_PKG="rocky-release-9.0-2.3.el9.noarch.rpm"

REPOS_PKG="rocky-repos-9.0-2.3.el9.noarch.rpm"

GPG_KEYS_PKG="rocky-gpg-keys-9.0-2.3.el9.noarch.rpm"

Install the required packages with:

sudo dnf install $REPO_URL/$RELEASE_PKG $REPO_URL/$REPOS_PKG $REPO_URL/$GPG_KEYS_PKG

Remove the redhat-logos directory, otherwise the upgrade will fail, with the command:

sudo rm -rf /usr/share/redhat-logos

Finally, upgrade Rocky Linux from 8.x to 9 with:

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

After the installation completes, rebuild the RPM database with:

sudo rpm --rebuilddb

Once everything is taken care of, reboot the system and log into Rocky Linux 9.

Congratulations, you’ve just upgraded from Rocky Linux 8.x to 9. I highly recommend you test this process on a non-production machine, before diving into your data center with the above commands. Once you are comfortable with the process, go ahead and run it on your production servers and enjoy those new features and improvements.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

[ad_2]

Source link

You May Also Like

More From Author