Zhou haihan 2010.7.12
Ubuntu 10.04 has the following problems when installing Ruby and rails:
'Require ': no such file to load -- mkmf (loaderror)
Installation Process:
Install ruby1.9.1
Zhouhh @ zhh64 :~ $ Sudo apt-Get install ruby1.9.1-full
Zhouhh @ zhh64 :~ $ Sudo apt-Get install rubygems1.9.1
GEM is Ruby's automatic packaging and Installation tool.
Install MySQL server and client
Zhouhh @ zhh64 :~ $ Sudo apt-Get install mysql-server-5.1 php5-mysql
Libmysqlclient-dev libmysqld-dev mysql-client-5.1
However, an error is reported when you use gem to install MySQL.
Zhouhh @ zhh64 :~ $ Sudo gem install MySQL
Building native extensions. This cocould take a while...
Error: Error installing MYSQL:
Error: failed to build gem native extension.
/Usr/bin/ruby1.9.1 extconf. Rb
Extconf. RB: 10: In 'require ': no such file to load -- mkmf (loaderror)
From extconf. RB: 10: In '<main>'
Gem files will remain installed in/var/lib/gems/1.9.1/gems/mysql-2.8.1 for inspection.
Results logged to/var/lib/gems/1.9.1/gems/mysql-2.8.1/EXT/mysql_api/gem_make.out
I found a lot of information, saying that ruby-Dev is not installed, but it is actually installed.
Two versions of Ruby are installed later, causing problems.
Zhouhh @ zhh64 :~ $ Ruby-V
Ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
Directly execute Ruby, Which is built-in to the system, 1.8.7
Delete ruby1.8
Zhouhh @ zhh64 :~ $ Sudo apt-Get remove ruby1.8
Just install it again.
Zhouhh @ zhh64 :~ $ Sudo gem install MySQL
Building native extensions. This cocould take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing Ri documentation for mysql-2.8.1...
Updating class cache with 2469 classes...
Installing rdoc documentation for mysql-2.8.1...
Install rails
Zhouhh @ zhh64 :~ $ 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.8
Successfully installed activerecord-2.3.8
Successfully installeds rack-1.1.0
Successfully installed actionpack-2.3.8
Successfully installed actionmailer-2.3.8
Successfully installed activeresource-2.3.8
Successfully installed rails-2.3.8
8 gems installed
Installing Ri documentation for rake-0.8.7...
Installing Ri documentation for activesupport-2.3.8...
Installing Ri documentation for activerecord-2.3.8...
Installing Ri documentation for rack-1.1.0...
Installing Ri documentation for actionpack-2.3.8...
Installing Ri documentation for actionmailer-2.3.8...
Installing Ri documentation for activeresource-2.3.8...
Installing Ri documentation for rails-2.3.8...
Updating class cache with 0 classes...
Installing rdoc documentation for rake-0.8.7...
Installing rdoc documentation for activesupport-2.3.8...
Test Ruby
Zhouhh @ zhh64 :~ $ IRB
Bash:/usr/bin/IRB: No file or directory
Zhouhh @ zhh64 :~ $ Irb1.9.1
IRB (main): 001: 0> 3 + 2
=> 5