安装Ruby,Railsaptitude install ruby libzlib-ruby rdoc irborapt-get install ruby libzlib-ruby rdoc irb测试debian:/var/www/python# irbirb(main):001:0> 3+5=> 8安装rails从 http://rubyforge.org/frs/?group_id=307 获得安装包如:rails-0.14.4.tgztar zxvf rails-0.14.4.tgzcd railsruby script/serverhttp://locahost:3000 :) OK[编辑]推荐安装方式从 http://ww.ruby-lang.org/en 获得 rubytar zxvf ruby-x.y.z.tar.gzcd ruby-x.y.z./configuremake make testmake install从http://rubygems.rubyforge.org 获得 rubygems如 tar zxvf rubygems-0.8.11.tar.gzcd rubygems-0.8.11 ruby setup.rb allgem install rails --include-dependencies更新 Railsgem update rails创建第一个应用rails yourapp在yourapp下新建一个控制器ruby script/generate controller say代码在 app/controllers/say_controller.rb,内容如下class SayController endSayController继承ApplicationController加一个hello的action,添加def helloend[编辑]Lighttpd// install FastCGIwget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gztar xzvf fcgi-2.4.0.tar.gzcd fcgi-2.4.0./configure –prefix=/usr/localmakesudo make installcd ..// 添加 Ruby-FastCGI 绑定wget http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gztar xzvf ruby-fcgi-0.8.6.tar.gzcd ruby-fcgi-0.8.6/usr/local/bin/ruby install.rb config –prefix=/usr/local/usr/local/bin/ruby install.rb setupsudo /usr/local/bin/ruby install.rb installcd ..// 安装 PCREwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-6.6.tar.gztar xzvf pcre-6.6.tar.gzcd pcre-6.6./configure –prefix=/usr/local CFLAGS=-O1makesudo make installcd ..// 安装 lighttpdwget http://lighttpd.net/download/lighttpd-1.4.11.tar.gztar xzvf lighttpd-1.4.11.tar.gzcd lighttpd-1.4.11./configure –prefix=/usr/local –with-pcre=/usr/localmakesudo make installcd ..启动 rubyruby script/server=> Booting lighttpd (use ’script/server webrick’ to force WEBrick)=> Rails application started on http://127.0.0.1:80=> Call with -d to detach=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)此时启动了 Lighttpd web serverhttp://localhost[编辑]Apache修改 vi /etc/apache2/sites-enabled/000-defaultAlias /yourapp/ "/var/www/rails/yourapp/public/" Options ExecCGI FollowSymLinks AddHandler cgi-script .cgi AllowOverride all Order allow,deny Allow from all/etc/init.d/apache2 restarthttp://localhost/rails/yourapp/public/ :)[编辑]Database libmysql-ruby libpgsql-ruby libsqlite3-ruby# apt-get install libpgsql-ruby# irbirb(main):001:0> require 'postgres'=> trueirb(main):002:0> exit[编辑]RadRails从 http://www.radrails.org/ 获得安装包 09-04 05:48