Category Archives: Ruby

Install Ruby for Rails on Amazon Linux

A quick HOWTO on how to install Ruby for Rails on Amazon Linux

Check your Ruby version (bundled in Amazon Linux)

ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-linux]

Check your sqlite3 version (bundled with Amazon Linux)

sqlite3 --version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668

Check Rubygems version (bundled with Amazon Linux)

gem -v

Install Rails (this sticks on the command line for a while, be patient. The extra parameters exclude the documentation, which if installed, can melt the CPU on smaller instances whilst compiling)

sudo gem install rails --no-ri --no-rdoc

Check Rails installed

rails --version
Rails 4.1.6

Install gcc (always handy to have)

sudo yum install -y gcc

Install ruby and sqlite development packages

sudo yum install -y ruby-devel sqlite-devel

Install node.js (Rails wants a JS interpreter)

 sudo bash
curl -sL | bash -
sudo yum install -y nodejs

Install the sqlite3 and io-console gems

gem install sqlite3 io-console

Make a blank app

mkdir myapp
cd myapp
rails new .

Start it (in the background)

bin/rails s &

Hit it

wget -qO- http://localhost:3000

Debug (Rails console)

bin/rails c