Install Ruby with an environment manager.

You might prefer to use Ruby environment managers like:

$ rbenv install 3.0.0

$ rvm install 3.0
$ rvm use 3.0

I’ve never used them as I’ve never had to.

If your Linux distro doesn’t support Ruby 3 yet, you might have to use one of the above.