1.安装Ruby
$ sudo apt-get install ruby
$ rbuy -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
2.安装RubyGems
$ sudo wget http://rubyforge.org/frs/download.php/56227/rubygems-1.3.3.tgz
$ tar -xvzf rubygems-1.3.3.tgz
$ cd rubygems-1.3.3
$ sudo ruby setup.rb
$ gem -v
1.3.3
3.安装rails
这里使用gem安装
$ sudo gem install rails
rails -v
Rails 2.3.2
4.创建应用
$ rails demo
cd demo
5.开启服务
ruby script/server
报错:`require_frameworks': no such file to load -- net/https (RuntimeError)
原来是缺少 libopenssl-ruby library:
解决方案:
$sudo apt-get install libopenssl-ruby
再次运行ruby script/server
=> Booting WEBrick
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2009-05-25 00:21:38] INFO WEBrick 1.3.1
[2009-05-25 00:21:38] INFO ruby 1.8.7 (2008-08-11) [i486-linux]
[2009-05-25 00:21:43] INFO WEBrick::HTTPServer#start: pid=7816 port=3000
成功了,用浏览器打开http://localhost:3000/
Welcome aboard
成功安装好ruby和rails并成功创建demo控制器。
写篇日志记录,good luck!!