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.
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
Now let us get the rvm installation script by this command.
curl -sSL https://get.rvm.io | bash -s stable
Set the source using this command -
And now install rvm dependencies using this command -
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 is successfully installed and setup. Let’s move to another step now.
We will now install bundler.
gem install bundler
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
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.
It will show you that ruby is installed.
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.