In this article we will provide basic steps on how to install Ruby on Rails onto Ubuntu based VPS. Ruby on Rails is one of the most popular programming languages nowadays based on GitHub.

Ruby is known among programmers for a terse, uncluttered syntax that doesn’t require a lot of extra punctuation. Compared to Java, Ruby is streamlined, with less code required to create basic structures such as data fields.

Rails is a framework for building websites. As such, Rails establishes conventions for easier collaboration and maintenance.

Preparation

Before you start installing Ruby on Rails, prepare your server for it. Make sure your system is update:

apt-get update && apt-get -y upgrade

Also, you will be required to install Curl at some point, why not at the beginning:

apt-get install curl -y

Installation

After that, you will need to install Ruby Version Manager (RVM), which will help to follow newest available Ruby version and install them quicker:

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

Before starting to use RVM, you need to execute one more command:

source /usr/local/rvm/scripts/rvm

You can list all available Ruby versions:

rvm list known

You will be presented with a list of available versions, like example below:

You can choose one and install as following:

rvm install 2.4.1

Once you install Ruby, you can check the version with the following command:

ruby --version

You will see something like:

ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

After Ruby is installed, you may as well proceed with Rails installation:

gem install rails

You can check Rails version at any time as well:

rails -v

Results should be as following:

Rails 5.1.4

That is it. You have installed Ruby on Rails. Now you can start your new Rails application:

Starting a new Ruby on Rails project

We will create a new project-specific gemset. When we create the gemset, it will be empty (though it inherits use of all the gems in the global gemset). However, we will be able to install a more specific version of Ruby if needed. As you may understand RVM allows you to use multiple Ruby version with every new project (gemset). We also install Raills as a framework for specific gemset.

mkdir new
cd new

Then we will set what version of Ruby will be used:

rvm use ruby-2.4.1@new --ruby-version --create

As well as installing Rails to this specific gemset for your specific application:

gem install rails

After that just start the new project:

rails new itdatatelecom

That is it, your project (gemset) has been created.

Je li Vam ovaj odgovor pomogao? 100 Korisnici koji smatraju članak korisnim (395 Glasovi)