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 and that’s what we’ll be sharing with you in this particular tutorial. RVM, Ruby Version Manager comes to the rescue and we will be using that tool for our installation process.
I assume that you have already done the Ubuntu server set up. Also the user should have root privileges. If not, refer to this tutorial for doing the initial Ubuntu 14.04 server set up and creation of new privileged user.
Installation of Ruby with RVM
Ruby Version Manager will allow you to use different versions of Ruby on VPS. Here, we will install the latest version of the Ruby on droplet.
To begin with the RVM installation, open the terminal and run the command:
\curl -sSL https://get.rvm.io | bash -s stable --rails
You need to enter the user password for installation process.
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. The ‘-s’ flag allows the command to operate in a silent mode and ‘-L’ flag lets the utility to follow redirects.
The second half of the command specifies the latest version of rvm and latest stable Rails.
The installation process may take a while to get completed. Once the installation is done, load RVM.
Installation of Specific Versions of Ruby and Rails
RVM allows you to install the specific versions of Ruby and Rails for your application.
rvm install ruby_version
You just have to replace the ruby_version with actual value. We need to specify the exact version of Ruby, since we are accessing it through that program with several varieties of Ruby versions.
You can view the available version of the installed Ruby by using this command:
In case if you wish to switch between Ruby versions, you can achieve that by using:
rvm use ruby_version
Similarly, you are allowed to use different versions of Rails with Ruby. You can do that using the gem commands. You will have to create the gemsets first and then install Rails with usual gem command. Here is how it’s done:
rvm gemset creategemset_name # create a gemset rvm [email protected]_name # specify Ruby version and our new gemset gem install rails -vrails_version # install specific Rails version
The gemsets ate responsible for having multiple self-contained environments for each version of Ruby we installed.