Shiva Bhusal
Shiva's Blog


Shiva's Blog


Installation Guide: Ruby On Rails: Ubuntu 14.04

Shiva Bhusal's photo
Shiva Bhusal
·Oct 10, 2014·

2 min read

Play this article

Installing Ruby


RVM is the best Tool to manage multiple versions in your system.

# Update your package manager first:

$ sudo apt-get update
# Install dependencies for ruby
# This installs CURL, Git and other dependencies

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
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
# To get the signature
gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

if it fails:

 command curl -sSL | gpg --import -
curl -L | bash -s stable
For all in one installation append --rails or --ruby or --ruby=1.9.3
Note: RVM might not be available right after installation is complete. Restart the terminal once after installation is completed.
#[rvm install ruby] installs latest version of ruby
rvm install 2.1.2
rvm use 2.1.2 --default

# Check the version of ruby installed
ruby -v

Configuring Git

git config --global color.ui true
git config --global "YOUR NAME"
git config --global ""

# Create SSH Key
ssh-keygen -t rsa -C ""

# Now you need to add this public key to your github account
# You need to copy and paste the content of ~/.ssh/ file to
# after clicking Add SSH Key buttton
# Once you have done this, you have to type following command to check
# if it worked

ssh -T

# Hopefully, you will get this echoed

"Hi excid3! You've successfully authenticated, but GitHub does not provide shell access."

Installing Rails

We need to install javascript runtime like NodeJS. This will let you use CoffeeScript and Gems you use to minify your javascripts (such as uglifier).

To install NodeJS, we need to add it using a PPA repository:

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem install rails
# Check the version of rails installed

rails -v
# Rails 4.1.6

Setting Up MySQL

sudo apt-get install mysql-server mysql-client libmysqlclient-dev

Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.

Share this