Although i have nice Ruby on Rails support at dreamhost, i have decided to install RoR to my local machine. IMHO a local RoR, combined with Radrails and WEBrick is the simplest and quickest solution, usually fully enough for development purposes.
To install Ruby on Rails, you just need to do 3 things:
- Install Ruby
- Install RubyGems, a package management system for Ruby
- Once you have RubyGems installed, it is a piece of cake to install new packages. In this concrete case:
gem install rails –include-dependencies
And you are on rails! This was easy, wasn’t it?
Well, yes, unless you happen to use Ubuntu .
Under Ubuntu, the MySQL-Ruby binding was outdated. No problem, just get the newest mysql-ruby gem:
gem install libmysql-ruby
At this point the trouble begun. Instead of installing the mysql binding, i got every kind of nasty error messages, including:
ERROR: While executing gem ... (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection. ruby extconf.rb install mysqlnchecking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no
WTH?! I have googled a day to find the problem, then also wrote to the RoR and Ruby mailing lists, but got no answer. As i came to know later, this happened because my problem had nothing to do with Ruby, Rails or MySQL.
After several hours of trying every possibility, i have been checking the last one: Do i have gcc and make on my machine? Well, i did not! I have thought a decent linux distribution should have make, gcc et al – and i was wrong (considering that Ubuntu is a decent distro).
Ubuntu is a very nice distribution, for desktop usage. However, if you are planning to use it for development, compiling etc., double check whether you have basic development tools (apt-get install build-essential), gcc and whatever you may need for compiling/deploying your applications.
Or install Rubuntu…