安装 ruby:

1
sudo apt-get install ruby1.9.1 ruby1.9.1-dev

安装 rubygems:

1
sudo apt-get install rubygems

安装 mysql

1
sudo apt-get install mysql

安装 ruby-mysql

1)下载:http://www.tmtm.org/en/ruby/mysql/ruby-mysql-0.2.6.tar.gz

2)解压安装:

1
2
3
ruby setup.rb
ruby test.rb hostname user passwd 
ruby install.rb

安装 rails

1
sudo apt-get install rails

更新 rake

1
sudo gem install rake

遇到的问题:

问题1:

1
mysql_config: command not found

解决:

1
sudo apt-get install libmysqlclient-dev

问题2:

1
Client does not support authentication protocol requested by server

解决:

登录 mysql,重设密码

1
set password for 'root'@'localhost'=old_password('password');

问题3:

1
undefinedmethod `more_results' for #<Mysql>

解决:

注释 mysql_adapter.rb 中的 318 行和 642 行

1
/usr/lib/ruby/vendor_ruby/active_record/connection_adapters/mysql_adapter.rb