Home » Ruby Tutorial Box » How to install Ruby on Rails in Ubuntu

How to install Ruby on Rails in Ubuntu

Ubuntu

Ruby on Rails is an application stack that provides developers with a framework to quickly create a variety of web applications.
so, how to use it?
very easy,please follow these steps is install and use it.


step 1.  Install git and cURL

First of all, update your package repository.

git is a simple, fast and efficient version control system. It is easy to learn, so even if you don’t have any experience with git you can try it in your next rails project (or any other project). you will love it.

Curl is a simple command line utility for getting file over web protocols, based on libcurl. To install curl simply execute –

step 2. Install RVM and Dependencies

RVM is not strictly required but it makes ruby management a lot easier. You can try different implementations of ruby, different versions of ruby and all without any pain. So it’s strongly recommended. but RVM requires the command to be executed as login shell, so open a terminal and go to Edit -> Profile Preferences -> Title and Command and check the box that says “Run Command as a login shell“. (look at the above snapshot)

Now, you must load the RVM

Then install additional dependencies specified by the RVM –

Installing Javascript Runtime

In newer version of Rails, you also need a Javascript runtime. Although you could install it from the package repository but it’s very outdated. So I recommend installing it using the PPA. (and I’ll also update the script)

step 3. Install Ruby

Now, you got RVM running, installing and running multiple versions or just one version of Ruby is very simple. To install Ruby just pass the version number to rvm install command (or some other implementation of ruby if you want; RVM also supports rbx, ree, JRuby, IRonRuby other than the default MRI) –

Then select the Ruby version you want to use, (or make it default so that you don’t have to select it again in new session)

Now, you can check the version of ruby, you’re running right now-

step 4. Install Rails

RVM installs ruby as well as the gem utility (managing ruby libraries). To install rails, simply install it using the gem. It will automatically install the latest version unless you specify the version explicitly.

Now You’re ready to go.

Now, open a browser and go to http://localhost:3000. :)