Installing Ruby on Rails Environment on Ubuntu v 14.10


This is a step by step guide to getting your ruby on rails / Postgres environment to work on an Ubuntu Linux machine. Just follow the guide and install your application files


Installing Ruby


The first step is to install some dependencies with these commands:

  • $ sudo apt-get update
  • $ sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties

Installing Rvm:

  • $ sudo apt-get install libgdbm-dev libncurses5-dev automake libtool $ bison libffi-dev
  • $ curl -L https://get.rvm.io | bash -s stable
  • $ source ~/.rvm/scripts/rvm
  • $ echo “source ~/.rvm/scripts/rvm” >> ~/.bashrc
  • $ rvm install 2.1.2
  • $ rvm use 2.1.2 —default
  • $ ruby -v
  • $ echo “gem: —no-ri —no-rdoc” > ~/.gemrc

Installing Rails


  • $ sudo add-apt-repository ppa:chris-lea/node.js
  • $ sudo apt-get update
  • $ sudo apt-get install nodejs
  • $ gem install rails

you can run the rails -v command to make sure you have everything installed correctly.


Installing Postgres


The postgres installation doesn’t setup a user for you, so you’ll need to follow these steps to create a user with permission to create databases.

  • $ sudo -u postgres createuser <usernameGoesHere> -s
  • # If you would like to set a password for the user, you can do the following
    sudo -u postgres psql
    postgres=# \password <passwordGoesHere>

become postgres user then create roorah role

  • $ sudo su — postgres

Or the more modern form:

  • $ sudo -u postgres -i
  • $ psql -d postgres
  • $ postgres=# create role app_name login createdb;
  • $ postgres=# \q