hailjakeFeb 262 min read
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
- $ sudo sh -c “echo ‘deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main’ > /etc/apt/sources.list.d/pgdg.list”
- $ wget —quiet -O — http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
- $ sudo apt-get update
- $ sudo apt-get install postgresql-common
- $ sudo apt-get install postgresql-9.3 libpq-dev
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