Javatpoint Logo
Javatpoint Logo

Ruby on Rails Installation

We will set up Ruby on Rails in Ubuntu 14.04 operating system.

There are three methods to install Ruby:

  • Using rbenv (recommended)
  • Using rvm
  • From source

We will install using rbenv as it is the most recommended way.

First we will install some dependencies for Ruby:

Install rbenv

Installing rbenv is a simple two way process. First rbenv will be installed and then ruby-build.

Follow the following commands:

The above command will install rbenv in your home directory and will set the appropriate environment variables.

Install Ruby

Install Ruby using following commands:

To disable Rubygems which generate local documentation for each gem that you install, use following command:

Now you need to install bundler gem to manage application dependencies with following command.

Install Rails

Install Rails using following command,

You can specify the version of Rails which you want to install using -v option in the above command.

Now we will run rehash sub-command. This will install shims for all Ruby executables known to rbenv, which allow you to use executables.

To verify the installed Rails version, use the following command.

Ruby On rails installation 1

Install JavaScript Runtime

Some Rails features like Asset Pipeline, depends on JavaScript runtime. To get this functionality, we need to install Node.js.

Now update apt-get and install Node.js packet.

Now you have successfully installed Ruby on Rails on your system.

Install Database

Rails default database is Sqlite3. If you want to use some other database due to any reason, then you need to install it.

Here, we will install MySQL server as our database.

After this, install mysql2 gem, with following command.

Now you can easily use MySQL with Rails in your system.

Next TopicRuby on Rails Ide

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials

B.Tech / MCA