Ruby on Rails is an open source web framework that runs on Ruby programming language. The integrated use of Ruby programming language and Rails development framework makes it popular among developers creating sites and web apps.
Installing Ruby on Rails on to a virtual private server does take some time. There are quite a few helpful tools to make installation easier. RVM, Ruby Version Manager is one such tool and we will be using that for our installation process.
This tutorial requires you to have the Ubuntu server set up and a user with sudo privileges. Refer to this tutorial for getting it done.
Installation of Ruby with RVM
As always, run an update as the first step of installation process, to ensure that the downloaded packages are up to date on your VPS.
sudo apt-get update
Now, you can start installing Ruby Version Manager (RVM). This program will allow you to use different versions of Ruby on VPS. Here, we will install the latest version of the Ruby on droplet.
We will be using the curl tool for installation. In case if you don’t have it on your system, install curl using the given command:
sudo apt-get install curl
To begin with the RVM installation, open the terminal and run the command:
\curl -L https://get.rvm.io | bash -s stable
The curl option enables us to make use of the script from the RVM website. The backslash (\) used in curl command signifies the absence of any alteration or alias version of the command.
Once the RVM is installed, you will have to load it. Exit your session and log in again.source ~/.rvm/scripts/rvm
In the case of RVM, we need to see what all are its requirements that have to be installed. If any of its dependencies are missing, it will not work. To install the dependencies automatically, run this command:
You have to enter your root password for installing the dependencies.
Once RVM is installed, installation of Ruby is quite simple. Run the command to start installation.
rvm install ruby
Installation of Ruby is done now. We need to specify the exact version of Ruby, since we are accessing it through that program with several varieties of Ruby versions.
rvm use ruby --default
Installation of RubyGems
Here, in this step, we are going to install RubyGems which will make sure we have installed all the required components of Ruby on Rails. For the installation of RubyGems too, we will use RVM:
rvm rubygems current
Installation of Rails
Once you have installed Ruby and RubyGems, you can start installing Rails. Run the command on your terminal:
gem install rails
This process will take some time to complete. Make sure you don’t interrupt it. Once the installation is done, you are good to go. Ruby on Rails is officially installed on your droplet.