[FIX] Installing Ruby on Rails 3, MySQL and SOLVE few problem on UBUNTU 10.10 (Maverick)

This is my experience while try to install Ruby on Rails 3 and MySQL on Ubuntu 10.10
Based on googling, I found few of problem too and I hope this experience will help everyone.

Installing from terminal:

STEP #1 {RAILS}

sudo apt-get install ruby-full
wget production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar -xvf rubygems-1.3.7.tgz
cd rubygems-1.3.7/
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
sudo gem install rdoc
sudo gem install rails

STEP #2 {MySQL Server}

sudo apt-get install mysql-server libmysqlclient-dev libmysql-ruby

STEP #3 {Setting up your first Rails project}

It seems ruby using sql lite as default driver, try to install it too. Even you doesn’t need it

sudo apt-get install libsqlite3-dev build-essential
rails new railsapp
cd railsapp/
bundle install
rake db:create
rails server -p 3003

Open url with browser:

http://localhost:3003/

STEP #4 {PROBLEM HANDLING}

This is few or problem that was I received from terminal, when I try to execute bundle install from my application with lof of gems. Few of gem get troubles.
A. File not found: lib
[SOLUTION]
Simply create lib folder in your rails version:

mkdir /usr/lib/ruby/gems/1.8/gems/rails-3.0.6/lib

Then try again to execute #sudo gem install rails
B. ERROR: Error installing rails:
invalid gem format for /usr/lib/ruby/gems/1.8/cache/activerecord-2.0.2.gem
-OR-
invalid gem format for /usr/lib/ruby/gems/1.8/cache/railties-3.0.3.gem
[SOLUTION]

cd /usr/lib/ruby/gems/1.8/cache/
rm actionpack-2.1.0.gem
cd /usr/local/rubygems-0.9.5/
gem update system
gem install rails

Those solution will remove all thing on chace folder, this is cause of “Error installing rails:”
C. REINSTALLING ALL GEM

gem list --no-versions | sed -e '/^(*|$)/d' > installed_gems
sudo gem uninstall --a --ignore-dependencies .+
cat installed_gems | xargs sudo gem install
rm installed_gems

NOTE: I hope after this line, you will able to run ruby apps on your ubuntu with all of gem needed.
Reference:
http://digg.com/story/r/ruby_on_rails_3_and_mysql_on_ubuntu_10_10
http://digg.com/story/r/ruby_ror_tip7_installing_rails3_file_not_found_lib_spritle_s_blog
http://digg.com/story/r/ruby_on_rails_blog_of_railshouse_re_installing_all_gems_automatically

Leave a Reply

Your email address will not be published. Required fields are marked *