Thursday, April 7, 2011

Install Rails 3 in Ubuntu

Here are simple steps to instal rails 3 on ubuntu,
i assume that you have already installed the rails 2.x version,
this post will help you to install rails 3 over that.


Step1.

# sudo gem uninstall rails
# sudo apt-get purge ruby rubygems

install Ruby 1.9.2 version.

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

# tar -xvvf ruby-1.9.2-p0.tar.gz

# cd ruby-1.9.2

# ./configure

# make

# sudo make install

Step2.

Now install Rails 3 version:
# sudo gem install rails --version 3.0.0

# sudo bundle install

Now in case you face problem in installing the rails gem,
below are the fixes i found to fix them.
ruby-1.9.2-p0. After I unpacked it, I built zlib as follows:


Issue1:
cd ruby-1.9.2-p0/ext/zlib
ruby extconf
.rb
make
sudo make install
sudo gem install rails

Issue2:

This worked for me as well.

$ sudo aptitude install libssl-dev libopenssl-ruby1.8

$cd /ruby_install_dir/ext/openssl
$ ruby extconf.rb
$ make
$ make install

Step3.

Now you need to install the mysql Gem for rails 3.
$ sudo gem install mysql2

in case you face an issue with mysql gem
below is the fix for installing mysql gem

Issue3:
# sudo apt-get install libmysqlclient15-dev (for mysql-5.*)
or
# sudo apt-get install libmysqlclient12-dev (for mysql-4.*)

# sudo apt-get install libmysql-ruby ruby-dev

Now again try with $sudo gem install mysql2

Thats it now you can create applications in Rails 3:

Issue4:

if you get readline error:

sudo apt-get install libncurses5-dev libreadline5-dev

cd ruby-1.9.2-p0/

cd ext/

cd readline/


ruby extconf.rb



Example: $ rails new test_app -d mysql

2 comments: