[Resolved]-Ruby On Rails : Setting the environment in Linux

Install Ruby on Rails : Using apt

I followed the steps mentioned in http://wiki.rubyonrails.org but unfortunately I was stuck with the following issue
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9 extconf.rb install mysql
extconf.rb:1:in `require’: no such file to load — mkmf (LoadError)
from extconf.rb:1:in `<main>’

Attempting to install the mysql adapter with gem fails; the following is a transcript of the attempt:

Install Ruby and Related libraries
1.$ sudo apt-get install ruby-full build-essential
2.$ ruby -v gives ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
3.$ ruby -ropenssl -rzlib -rreadline -e “puts :Hello” to test libraries prints ‘Hello’

Install RubyGems
4.Download Rubygems from http://rubyforge.org/frs/?group_id=126&release_id=34146 and
Unzip the downloaded gem package as below:
5.saffrongeek@saffrongeek-laptop:~/Desktop$ tar -xvzf rubygems-1.3.3.tgz
6. Change to unzipped directory and do the following
saffrongeek@saffrongeek-laptop:~/Desktop$ cd rubygems-1.3.3/
saffrongeek@saffrongeek-laptop:~/Desktop/rubygems-1.3.3$ ruby setup.rb
Installing RubyGems
…..
——————————————————————————

RubyGems installed the following executables:
/usr/bin/gem1.8

Install Rails using Rubygems
7.
saffrongeek@saffrongeek-laptop:~/Desktop/rubygems-1.3.3$ sudo gem install rails –include-dependencies
INFO:  `gem install -y` is now default and will be removed
INFO:  use –ignore-dependencies to install only the gems you list
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.2
Successfully installed activerecord-2.3.2
Successfully installed actionpack-2.3.2
Successfully installed actionmailer-2.3.2
Successfully installed activeresource-2.3.2
Successfully installed rails-2.3.2
7 gems installed
Installing ri documentation for rake-0.8.7…
Installing ri documentation for activesupport-2.3.2…
Installing ri documentation for activerecord-2.3.2…
Installing ri documentation for actionpack-2.3.2…
Installing ri documentation for actionmailer-2.3.2…
Installing ri documentation for activeresource-2.3.2…
Installing RDoc documentation for rake-0.8.7…
Installing RDoc documentation for activesupport-2.3.2…
Installing RDoc documentation for activerecord-2.3.2…
Installing RDoc documentation for actionpack-2.3.2…
Installing RDoc documentation for actionmailer-2.3.2…
Installing RDoc documentation for activeresource-2.3.2…
saffrongeek@saffrongeek-laptop:~/Desktop/rubygems-1.3.3$

8.$ sudo gem install mysql
Building native extensions.  This could take a while…
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9 extconf.rb install –platform=ruby mysql — –with-mysql-config=/usr/bin/mysql_config
extconf.rb:1:in `require’: no such file to load — mkmf (LoadError)
from extconf.rb:1:in `<main>’
——————————————————————————————————————–
STUCK HERE, I STARTED MANY WORKAROUNDS TO RESOLVE MANUALLY BUT THE BEST AND SIMPLE ONE WAS TO USE SYNAPTIC MANAGER.
——————————————————————————————————————–
How I worked it out: Go to Administration->Synaptic Package Manager. Type in the search field ‘ruby’ and it lists all packages related. I selected ruby and related libraries especially many that appeared related to database domain. Once Marked installation I applied and some 134 packages were downloaded and applied successfully.

Now, Testing Rail

saffrongeek@saffrongeek-laptop:~/Desktop/rubygems-1.3.3$ rails myrailsapp
Generated Rails new project.
To support mysql use the following command
$ rails myrailsapp -d mysql

Now , let me start building my knowledge to Nerd on ROR 😀

Advertisements

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

%d bloggers like this: