Skip to content

Rails 3 on debian / ubuntu gnu/linux with Sqlite 3

October 13, 2010

Decided to move to Rails 3 recently and get up to speed on the new framework version.

I list here the process I followed to install it on Debian (Lenny).

[ Update: verified also on Ubuntu 12.04 in November 2012]

*Note, some of these commands need root / administrator privileges. Notably the apt and install commands. Use sudo, su or a root shell.

Install dependancies

# Optional VCS, we use Mercurial Locally and Git for deployments to Heroku (hosting)
apt-get install git-core mercurial


# libmysqlclient15off libreadline5-dev
apt-get install build-essential libreadline5-dev libssl-dev zlib1g zlib1g-dev libghc-yaml-dev

#optional Database, I have detail for getting Sqlite3 later
#apt-get install mysql-common mysql-server

Install Ruby

# version 1.9.2
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
tar xzf ruby-1.9.2-p0.tar.gz
cd ruby-1.9.2-p0


# OR version 1.9.3 (Ubuntu 12.04)
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar xzf ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0


./configure
make
make install

Install sqlite 3

wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz
tar xzf sqlite-amalgamation-3.7.2.tar.gz
cd sqlite-3.7.2/


wget http://sqlite.org/sqlite-autoconf-3071401.tar.gz
tar xzf sqlite-autoconf-3071401.tar.gz
cd sqlite-autoconf-3071401/


./configure
make
make install


gem install rails sqlite3-ruby


# need a JS runtime (javascript) for rails coffee scripts
sudo apt-get install nodejs npm

Create your rails app

rails new Items
cd Items
rails g scaffold Item name:string detail:text
rake db:migrate
rm public/index.html
vim config/routes.rb

add this line:

root :to => "items#index"

then start the server:

rails s

Open your browser and go to http://localhost:3000/

And that’s it!

About these ads

From → Open Source, TechIt

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: