20 C
Senior Writer and partner

How to install Ruby on Rails on ubuntu 18.04?

There are numerous specialized framework for web programming, which has PHP as its most popular language. However, today we will talk about one that stands out for its robustness and for being considered by many companies as their solution to create systems for the web: Ruby on Rails.

Rails is a framework for web applications that runs on the Ruby programming language. This means that you will not use PHP in this framework, so you must first learn the ruby language before using this popular framework.

Following the paradigm of the Model View Controller (MVC) pattern Ruby on Rails tries to combine simplicity with the possibility of developing real-world applications by writing less code than with other frameworks and with a minimum of configuration.

Let’s get to work!

1.- Upgrading the system

To install Ruby on Rails on Ubuntu 18.04 we will use RVM (ruby version manager) which will help us to install it more easily. First we will open a terminal emulator and proceed to update the system. Doing so is highly recommended to maintain optimal operating system performance. As root user, write:

- Advertisement -
:~$ sudo -i
:~# apt update && apt upgrade

1.- Upgrading the operating system
1.- Upgrading the operating system

After the process of updating the operating system is finished, we must install node and curl, two tools necessary to continue with the tutorial.

:~# apt install nodejs curl

2.- installing required packages
2.- installing required packages

Next, import the signature key to verify the download we will do with RVM.

:~# curl -sSL https://rvm.io/mpapis.asc | gpg --import -

3.- importing signature key
3.- importing signature key

Next we have to install RVM and the stable version of Ruby

:~#  curl -sSL https://get.rvm.io | bash -s stable --ruby

4.- Getting Ruby
4.- Getting Ruby

We proceed to update the shell to be able to use RVM:

:~# source /usr/local/rvm/scripts/rvm

5.- updating the shell
5.- updating the shell

And then we’ll install rails.

:~# gem install rails

6.- installing rails gem
6.- installing rails gem

Optionally we can choose a specific version of Rails, the syntax would be:

:~# gem install rails -v x.x

replace x.x with the version of your choice. I repeat, this is optional.

now, We verify the installation done:

:~# ruby -v
:~# rails -v

7.- Showing installed version
7.- Showing installed version

now to verify the installation, we must create a new project.

:~# cd /home/angelo/
:~# rails new example

8.- Creating a new project
8.- Creating a new project

We enter the project folder:

:~# cd example

And finally we must start the rails WEBrick server:

:~# rails s -b

And finally we go to the web browser and access the project created with our ip address through port 3000.


9.- Installation success
9.- Installation success

And that’s all there is to it! The main advantage of installing Ruby on Rails with this method is that we can use specific versions of the framework.


Please enter your comment!
Please enter your name here

Latest article