How To Install Ruby on Rails in Ubuntu 16.04

How To Install Ruby On Rails In Ubuntu 16.04

Hey, everyone. Today we will be setting up “ruby on rails” in one of the latest versions of ubuntu i.e. 16.04. We will go for rvm (Ruby Version Manager) which will let you manage work and switch between multiple ruby environments. I will provide screenshots and pictures (wherever I can) and the steps without hectic, so you guys can easily setup up and start app development quickly. Let us start.
Step 1

We will install rvm, which is pretty simple to install.Firstly request a key to verify the legitimacy of the RVM release we will be downloading, which is signed with the matching private key. To do this run this command.

gpg –keyserver hkp://keys.gnupg.net –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
install rvm key

Step 2​Now let us get the rvm installation script by this command.

curl -sSL https://get.rvm.io | bash -s stable
rvm installation setup

​Set the source using this command –
source ~/.rvm/scripts/rvm
And now install rvm dependencies using this command –

rvm requirements


​​Step 3

Now we will install ruby. This is also pretty simple and easy. Run this command to install search and install the latest version of ruby.
rvm list known
Now if latest version is 2.4.0 ( In screenshot I skipped above command as this version was what I wanted) (You could also skip that step and install your favorite version), then –
rvm install 2.4.0
rvm use 2.4.0 –default
ruby -v
install rvm and check ruby on rails version

​Ruby is successfully installed and setup. Let’s move to another step now.Step 4

We will now install bundler.

gem install bundler
gem install bundler in linux


​​Step 5

Before we now go to install rails, we must install NodeJS, a javascript runtime.
Let us add its repo and install it.
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash –
Now enter this command to install it.
sudo apt-get install -y nodejs
install nodejs in ubuntu 16.04


​Step 6

Now let us install rail via this command.
gem install rails
For a particular version like 4.2.6 use this
gem install rails -v 4.2.6
​And this command to make sure installation is successful.
rails -v
It will show you that ruby is installed.

Conclusion

​We have covered all the steps to install ruby on rails. (ROR) Still, I have seen many persons encountering numerous errors in installing it. This could be a reason that the dependencies are not satisfiable. You got broken packages, source not listed and many more. I had encountered no error in installing ruby on rails from beginning to end but all cases differ. Still I will say it is not that hard to install it.I have also skipped steps that I considered are not necessary for just setting up ruby on rails, so if you got any doubt that why a particular step is not here, don’t hesitate to comment below.

Also, those users who have already installed ruby on rails please mention your way, so new users can be benefitted and get help to various problems. Also, new methods will be added in the article to keep it updated.

SHARE THIS POST

MassiveGRID Banner

Leave a Reply

Your email address will not be published. Required fields are marked *