How to upgrade OS on the SAME server?

SYSTEM INFORMATION
OS type and version CentOS Linux 7.9.2009
Virtualmin version 7.10.0.gpl

So clearly I need to upgrade the OS. I look around the documentation here and I see advice on how to migrate to a new server, but I only have one VPS to use.

Advice is; Create a new server with an up to date OS, install Virtualmin, Transfer each domain to the new server.

But where do I create this “new server”? Or maybe I’m missing something, it’s been a couple of years since I’ve even looked at the system!

How do do this? I’m guessing there’s no easy way.

Why not make an off site back of your domains, then install the new os, install virtualmin and then restore the backups

This was my initial plan, but I have a lot of customisations and so I started looking here for tips. Then I got confused!

I guess there’s no way to upgrade the OS in-situ?

There is an OS upgrade path. Virtualmin is just a package like all of the others so this will not be a blocking factor.

A snapshot/full server back is always required before doing this.

The safest way is to migrate your clients data to a new server but if you are going to upgrade your OS you must plan and read on the Pros and Cons on line.

There are migration tools to move CentOS 7 to AlmaLinux or Rocky linux and they are well tested.

What sort of customizations? There is a chance these may no longer work due to the fact that your new os may have updated packages that no longer support your customizations, who knows only you. Doing a snapshot is a good idea assuming your provider supports that else you may have a bit of work to do

It is possible (but risky) to upgrade CentOS 7 in place to a newer supported distro. The path is a bit convoluted, but I’ve done it a few times.

You’ve waited a dangerous length of time to do it, though, as CentOS 8 Stream has also reached EOL, I think, so you’ve got to go through a now unsupported stage to get to a supported OS.

As I understand it, the best path for an in-place upgrade is this:

Upgrade CentOS 7 to CentOS 8 Stream. This is trickier for unsupported versions, as you have to manually update yum repos to use vault.centos.org repositories directly with a baseurl instead of a mirrorlist from mirror.centos.org. You can find a handful of tutorials for this, just make sure you’re looking at docs that cover doing it after the death of these OSes, since being EOL adds some steps. A quick search does not turn up great documentation about this, so I’m hesitant to make a recommendation. I think you want to read a few tutorials about it, so you get a good feel for what it looks like. It’s not hard, per se, but it is fiddly, and more fiddly for EOL distros. If the tutorial doesn’t cover updating repos to use vault.centos.org, it’s too old and doesn’t cover your EOL OS situation.

Then use migrate2rocky or the equivalent tool for Alma Linux to convert to either Rocky Linux or Alma Linux, and then upgrade to Rocky 9 or Alma 9. Then fix whatever is broken. There will be a few things, but I don’t know what off-hand, shouldn’t be anything too scary, though.

Make sure you have good backups, both Virtualmin and the OS itself, before embarking on anything dramatic. A multistage OS upgrade from a long EOL OS is very dramatic.

The migrate2rocky stage is well-documented, BTW, so once you get to CentOS 8 Stream, you’re probably in pretty good shape:

https://docs.rockylinux.org/guides/migrate2rocky/

Oh, that probably makes an in-place upgrade much scarier. What do you mean exactly? Have you replaced/upgraded OS packages with third-party stuff? That makes an in-place upgrade harder and riskier, the dependency graph goes wild with third-party repos enabled, and it becomes very broken when you try to upgrade those packages.

That’s one of the reasons I’m always advising extreme caution about using third-party package repositories. Sometimes it’s mostly harmless, like for PHP versions, which can simply be disabled and removed before the upgrade, or just ignore the problem and pick up the pieces after the upgrade. But sometimes it’s very scary, like databases where you might have to downgrade the database as part of the OS upgrade (e.g. if you have a newish Mariadb installed from the Mariadb folks, the version in CentOS 8 is probably older, which is potentially a quite complicated situation…maybe you can leave it alone, but probably not, Mariadb depends on a bunch of OS libs that will be changing across CentOS versions).

AWS rents space by the hour. Spin up an instance with your desired OS and do all updates. Then migrate your site to the new server for testing. When happy, do the same on your old server and migrate back and kill the AWS instance.