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:
:~$ sudo -i :~# apt update && apt upgrade
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
Next, import the signature key to verify the download we will do with RVM.
:~# curl -sSL https://rvm.io/mpapis.asc | gpg --import -
Next we have to install RVM and the stable version of Ruby
:~# curl -sSL https://get.rvm.io | bash -s stable --ruby
We proceed to update the shell to be able to use RVM:
:~# source /usr/local/rvm/scripts/rvm
And then we’ll install rails.
:~# gem install rails
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
now to verify the installation, we must create a new project.
:~# cd /home/angelo/ :~# rails new example
We enter the project folder:
:~# cd example
And finally we must start the rails WEBrick server:
:~# rails s -b 0.0.0.0
And finally we go to the web browser and access the project created with our ip address through port 3000.
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.