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 Upgrade
First, make sure to update and upgrade Ubuntu by running the 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 a 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
To start using RVM you need to run:
rvm list known
# 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 ...
rvm install 2.3.0 rvm use 2.3.0
Step 3. Installing Rails.
Now that RVM is installed and configured and Ruby is on the system, you can install Rails. Rails is available as a Gem, which is a Ruby package. When Ruby is installed, its native Gem packaging system is also installed. Installing Ruby packages is very similar to any Linux package manager. To install Rails you can use the command below:
gem install rails
gem install rails -v 5.0.0
Step 4. Check rails version
# rails -v Rails 220.127.116.11
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.