Verified and tested 06/01/21
Installing Rails in Ubuntu has gotten much more accessible in recent days. The easiest way to do this is via installing RVM (Ruby Version Manager).
An Ubuntu server. If you do not have one and would like to purchase one, you can visit our VPS Hosting page and spin a new server up in under 30 seconds.
Install Required Dependency
First, you will need to install some dependencies on your server. You can install all of them with the following command:
apt-get install gnupg2 curl wget -y
Once all the packages are installed, you can proceed to the next step.
Installing Rails on Ubuntu
In this section, we will show you how to install Ruby on Rails with RVM.
First, download and add the GPG key with the following command:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Next, install the RVM with the following command:
curl -sSL https://get.rvm.io | bash -s stable
Next, activate the RVM using the following command:
Next, install the latest stable version of Ruby with the following command:
rvm install 3.0.1
Next, set the Ruby version as the default version:
rvm use 3.0.1 --default
Next, verify the installed version of Ruby with the following command:
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]
Next, install the bundler with the following command:
gem install bundler
Next, install the Rails using the gem command:
gem install rails
Once the Rails is installed, verify the installed version of Rails with the following command:
You should get the following output:
Congratulations! You should now have rails installed on your ubuntu server.