Installing Ruby On Rails on Ubuntu 15.04 15.10

Ubuntu is a popular platform for Rails development. In this guide I’ll show you how to install rvm on Ubuntu 15.04 and use it to install a stable version of Ruby and of course Rails.

Installing RVM

Ruby Version Manager supports multiple versions of Ruby and enables to switch the version of Ruby at any time.

First, we’ll update the Ubuntu 15.04 packages:

Next, we’ll install the necessary dependencies:

Once this is complete, we’ll install RVM:

Installing Ruby

First, we’ll remove the pre-installed ruby:

After closing and reopening the terminal, we’ll install the Ruby Interpreter version 2.2.2 with this command:

This step will take a while as it downloads, configures, and compiles the necessary executables.

Finally, we’ll choose this version to be the default Ruby interpreter for new Terminal sessions with the following command:

Installing Ruby on Rails On Ubuntu

To install Rails (version: 4.21), we’ll run the following command:

Finally, we’ll verify that Rails 4.2.1 was successfully installed by typing:

Rails should reply with:

Installing MySQL

First, we’ll install the mysql server:

We’ll be prompted to set a root password for mysql server.

Finally, we’ll verify that mysql was successfully installed by typing:

We should get the reply:

mysql_status

Installing phpmyadmin

pMyAdmin is a free tool written in PHP, intended to handle the administration of MySQL over the Web. To install it, we’ll run the following command:

During the installation, phpMyAdmin will walk us through a basic configurations:

  • We’ll select Apache2 for the server
  • We’ll choose YES when asked about whether to Configure the database for phpmyadmin with dbconfig-common
  • We’ll enter the MySQL password when prompted
  • We’ll enter the password that we want to use to log into phpmyadmin

After the installation has completed, we’ll add phpmyadmin to the apache configuration:

apache2configuration

Next, we’ll add the phpmyadmin config to the file:

apache2configuration2

Next, we’ll restart the Apache server:

Finally, we’ll verify that phpmyadmin was successfully installed by opening Firefox and entering the url: localhost/phpmyadmin

We should get:

phpmyadmin

Installing PostgreSQL

First, we’ll install a new repository to download PostgreSQL
installnewrepository

To install postgresql we’ll run the following command:

Next, we’ll start the database:

Then, we’ll setup a user with permission to create databases:

Feel free to replace my name with yours.

Finally, we set the password “secret” for the created user by typing:

Installing pgAdmin

pgAdmin is a free tool intended to handle the administration of PostgreSQL.
To install it, we’ll run the following command:

Now that you have all setup let’s start building some killer rails apps!

Happy Coding!

Leave a Reply

2 Comments

  1. Skolar

    Excellent guide, went smoothly save for one hiccup. On Ubuntu 15.04, was getting a 404 when trying to access phpmyadmin. Fixed by creating a symbolic link…

    sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

    Kudos!

    • Hicham

      Thank you! Glad to read that you like it.

Next ArticleUsing Git in Java Projects