RVM- Ruby Version Manager is a tool meant to use the command line for installing and managing the various ruby versions easily. Here we see the commands for installation of RVM on Ubuntu 20.04 LTS Focal fossa.
What do we need to get RVM on Ubuntu Linux?
• Ubuntu or its based Linux distro
• A user with sudo rights
• Internet connection
Steps to install RVM to manager Ruby on Ubuntu 20.04 LTS
1. Open command Terminal
If you are using the graphical desktop version of Ubuntu 20.04 LTS then simply press the Ctrl+Alt+T to open the terminal app to run the required commands.
Run System update and install curl
sudo apt update sudo apt install curl
2. Add RVM GPG key on Ubuntu 20.04 Linux
Although we can install Ruby using the standard system repository of Ubuntu, however, to get the latest and old versions and manage them together on the same system or for different projects will be a lot easier using RVM. Therefore, add the GPG Key for the packages to install Ruby Version Manager on Ubuntu 20.04 LTS.
curl -sSL https://rvm.io/mpapis.asc | gpg --import - curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
3. Command to Install RVM on Ubuntu 20.04 LTS
Use the following command to download the script from GitHub for the installation of RVM.
curl -sSL https://get.rvm.io | bash -s stable
4. Check the RVM version
Once the installation is completed reload the shell to start using the RVM command-line tool:
Now to check the RVM version installed on your system:
Output in our case:
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
5. List Ruby version available to install
To know and list what are the Ruby versions available to install on your Ubuntu 20.04, we can use this RVM command:
rvm list known
6. Install the latest ruby
To get some particular version on your system or the latest one we can use the RVM tool as well.
For the latest one:
rvm install ruby
To get some particular old version, declare the version number:
rvm install 2.7.2
7. Set default or Switch to the Ruby version you want to use
You can set some particular Ruby version as the default one or switch to the one that you want to use currently for your project, in case multiple are installed.
Login to Shell
To use a Ruby version
rvm use 3.0.0
For setting default one:
rvm use 3.0.0 --default
To check the currently used Ruby version: