Monday, November 18, 2013

How to install Ruby 2.0.0p247 and Rails 4.0 on Amazon Ubuntu instance

How I installed Rails

First install Ruby:

I tried to avoid using sudo.  I don't remember exactly when I used sudo in the steps below.  When you see "sudo", that's a post-install guess that I probably used it there.

sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/usr/local
make
sudo make install

----------------------

I installed Rails by following this web page:

https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm

Noting the relevant bits here in case that page goes down/changes:

sudo apt-get update
sudo apt-get upgrades
sudo apt-get install curl

This installs RVM.  RVM is a Ruby version manager.  I want this in case I need to use different versions of Ruby (maybe later).
\curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements

I don't know if this next part might be redundant.  I wonder if I should have installed RVM first, before installing Ruby.

rvm install ruby
rvm use ruby --default

This installs rubygems.  Not sure what gems are.  Wikipdedia says:

RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them.

rvm rubygems current

This installs rails:
gem install rails



----------------------

Currently trying to follow this introductory Rails guide:

http://guides.rubyonrails.org/getting_started.html

The guide assumes I have SQLite3 installed.  I think this installed sqlite3:

sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby

I don't recall if I had to configure stuff for sqlite3.  There may have been on-screen instructions I had to follow.