<\/span><\/h2>\n\n\n\nLog in to your Debian VPS with SSH as a root user:<\/p>\n\n\n\n
ssh root@IP_ADDRESS -p PORT_NUMBER<\/pre>\n\n\n\nRemember to replace IP_Address and Port_Number with your server\u2019s actual IP address and SSH port number respectively.<\/p>\n\n\n\n
You can check whether you have the proper Debian version installed on your server with the following command:<\/p>\n\n\n\n
lsb_release -a<\/pre>\n\n\n\nYou should get this output:<\/p>\n\n\n\n
No LSB modules are available.\nDistributor ID: Debian\nDescription: Debian GNU\/Linux 11 (bullseye)\nRelease: 11\nCodename: bullseye<\/pre>\n\n\n\nThen, run the following command to make sure that all installed packages on the server are updated to the latest available version<\/p>\n\n\n\n
apt update && apt upgrade<\/pre>\n\n\n\n<\/span>Step 2: Install RVM (Ruby Version Manager)<\/span><\/h2>\n\n\n\nOne way of installing Ruby on Rails is by using the Ruby Version Manager<\/code>, or shortly RVM<\/code>.<\/p>\n\n\n\nFirst, install the required dependencies with the following command:<\/p>\n\n\n\n
apt install apt-transport-https ca-certificates gnupg2 curl<\/pre>\n\n\n\nThen, we need to import the GPG key with the following command:<\/p>\n\n\n\n
$ curl -sSL https:\/\/rvm.io\/pkuczynski.asc | gpg2 --import -<\/pre>\n\n\n\nInstall the RVM stable version by running the command below:<\/p>\n\n\n\n
$ curl -sSL https:\/\/get.rvm.io | bash -s stable --ruby<\/pre>\n\n\n\nThe command will automatically install the packages required, and install the latest stable Ruby version.<\/p>\n\n\n\n
To start using RVM you need to run:<\/p>\n\n\n\n
source \/usr\/local\/rvm\/scripts\/rvm<\/pre>\n\n\n\nTo list which Ruby versions are available for installation, run the following command:<\/p>\n\n\n\n
rvm list known<\/pre>\n\n\n\nThe list should look like the following one:<\/p>\n\n\n\n
# MRI Rubies\n[ruby-]1.8.6[-p420]\n[ruby-]1.8.7[-head] # security released on head\n[ruby-]1.9.1[-p431]\n[ruby-]1.9.2[-p330]\n[ruby-]1.9.3[-p551]\n[ruby-]2.0.0[-p648]\n[ruby-]2.1[.10]\n[ruby-]2.2[.10]\n[ruby-]2.3[.8]\n[ruby-]2.4[.10]\n[ruby-]2.5[.8]\n[ruby-]2.6[.6]\n[ruby-]2.7[.2]\n[ruby-]3[.0.0]\nruby-head<\/pre>\n\n\n\n<\/span>Step 3: Install Ruby<\/span><\/h2>\n\n\n\nTo install a specific version of Ruby you can use the command:<\/p>\n\n\n\n
rvm install <version_number><\/pre>\n\n\n\nVerify the ruby version by running the following command:<\/p>\n\n\n\n
ruby -v\n<\/pre>\n\n\n\nThe output should be similar to the following:<\/p>\n\n\n\n
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]<\/pre>\n\n\n\nRun the following RVM command will help you to set the installed version of Ruby as the system default:<\/p>\n\n\n\n
rvm use --default 3.0.0<\/pre>\n\n\n\n