ruby-on-rails-with-mysql-on-ubuntu-8-10

Hi guys, I’m writing this to share with you the joy of using ROR with Mysql on Ubuntu 8.10 Desktop Edition.

First, we can get a latest free version of Ubuntu from here. Please choose a desktop edition, because Server Edition is not containing a GUI for us which specializing in host side.

Well, after we have installed the newest Ubuntu, let’s try our ROR with Mysql development enviroment ASAP. The official installing ROR site goes here, or you may need only type several commands as following:

1. Installing RUBY:

 sudo apt-get install ruby-full 
#’ruby-full’ package will make sure you have all the packages that add up to a full Ruby installation.
2. Installing RUBYGEMS:
wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar xzvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem 
3. Installing RAILS and Mongrel:
  sudo gem install rails mongrel  
# yeah, ROR has been done here!

4. Installing MYSQL:

  sudo apt-get install mysql-server mysql-client   

It seemingly worked and I could start my rails projects, but when I tried to rake task, the system was just crashed and came out a result:” !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted!”

Oops, let’s try to listen to it:
sudo gem install mysql  
it failed:
"Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb install mysql 
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options."
It made me feel quite irritating after I tried many times without efforts, but finally, the problem was solved by installing a package named libmysql-ruby1.8. This package is an API module that allows to access MySQL database from programs in Ruby programming language.

So let’s correct our step 4 to:

  sudo apt-get install mysql-server mysql-client   libmysql-ruby1.8

Cheers, we can really start our RAILS application now.

Last but not least, to make our default gnome-editor more useful as a programming IDE, we can try to install some plugins into gedit to make it like Textmate On Mac. e.g. there is an excellent project named gmate which included many plugins that we need indeed.

Please let me know when you still have any installing problems with ROR & MYSQL on Ubuntu.

Posted by Mysen Tue, 24 Feb 2009 00:00:00 GMT


Trackbacks

Use the following link to trackback from your own site:
http://www.kudelabs.com/trackbacks?article_id=77

Comments

  1. ifosen about 6 hours later:
    it's quite useful, thank you!