How To Install Ruby on RailsHow To Install Ruby on Rails? Ruby on Rails is an application stack that provides developers with a framework to quickly create a variety of web applications. Ruby on Rails does take a little while to install on a virtual server, but luckily there are a lot of helpful tools to make this process as easy as possible. You can run this tutorial on your droplet as a user with sudo privileges.
Step 1. Update and UpgradeFirst make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.
sudo apt-get update sudo apt-get upgrade
Step 2. Installing RVM.One way of installing Ruby on Rails on an vps is by using the Ruby enVironment Manager, or shortly RVM. We will use RVM to install Ruby on Rails in this tutorial. In order to install RVM on your server, you can use the following commands:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 cd /tmp && \curl -sSL https://get.rvm.io -o rvm.sh cat /tmp/rvm.sh | bash -s stable
If, for some reason, you need or want a different version of Ruby, you can check which ones are available easily in RVM:
rvm list known
The list result should look like the following one:
# MRI Rubies [ruby-] 1.8.6 [-p420] [ruby-] 1.8.7 [-head] # security released on head [ruby-] 1.9.1 [-p431] [ruby-] 1.9.2 [-p330] [ruby-] 1.9.3 [-p551] [ruby-] 2.0.0 [-p648] [ruby-] 2.1 [.8] [ruby-] 2.2 [.4] [ruby-] 2.3 [.0] [ruby-] 2.2-head ruby-head ...
To install a different version of Ruby, just find the version number that you want and tell RVM to install it:
rvm install 2.3.0 rvm use 2.3.0
Step 3. Installing Rails.
gem install rails
Or, run the following command to install a particular version of rails:
gem install rails -v 5.0.0
To verify the installation as well as to check what version of Rail you are currently using, you can use the command:
# rails -v Rails 22.214.171.124
Now you are ready to start with your first Ruby on Rails project. Create a new Ruby on Rails application in your home directory:
cd ~ rails new idrootAppThis should take no longer than a minute , Once your new Ruby on Rails application is created, you can start developing the application.