分类: LINUX
2007-01-16 12:30:31
aptitude install ruby libzlib-ruby rdoc irb
or
apt-get install ruby libzlib-ruby rdoc irb
测试
debian:/var/www/python# irb
irb(main):001:0> 3+5
=> 8
安装rails
从 获得安装包
如:rails-0.14.4.tgz
tar zxvf rails-0.14.4.tgz
cd rails
ruby script/server
:) OK
从 获得 ruby
tar zxvf ruby-x.y.z.tar.gz
cd ruby-x.y.z
./configure
make
make test
make install
从 获得 rubygems
如 tar zxvf rubygems-0.8.11.tar.gz
cd rubygems-0.8.11
ruby setup.rb all
gem install rails --include-dependencies
更新 Rails
gem update rails
创建第一个应用
rails yourapp
在yourapp下新建一个控制器
ruby script/generate controller say
代码在 app/controllers/say_controller.rb,内容如下
class SayController < ApplicationController
end
SayController继承ApplicationController
加一个hello的action,添加
def hello
end
// install FastCGI
wget
tar xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure –prefix=/usr/local
make
sudo make install
cd ..
// 添加 Ruby-FastCGI 绑定
wget
tar xzvf ruby-fcgi-0.8.6.tar.gz
cd ruby-fcgi-0.8.6
/usr/local/bin/ruby install.rb config –prefix=/usr/local
/usr/local/bin/ruby install.rb setup
sudo /usr/local/bin/ruby install.rb install
cd ..
// 安装 PCRE
wget
tar xzvf pcre-6.6.tar.gz
cd pcre-6.6
./configure –prefix=/usr/local CFLAGS=-O1
make
sudo make install
cd ..
// 安装 lighttpd
wget
tar xzvf lighttpd-1.4.11.tar.gz
cd lighttpd-1.4.11
./configure –prefix=/usr/local –with-pcre=/usr/local
make
sudo make install
cd ..
启动 ruby
ruby script/server
=> Booting lighttpd (use ’script/server webrick’ to force WEBrick)
=> Rails application started on
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
此时启动了 Lighttpd web server
修改 vi /etc/apache2/sites-enabled/000-default
Alias /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 restart
:)
# apt-get install libpgsql-ruby
# irb
irb(main):001:0> require 'postgres'
=> true
irb(main):002:0> exit
从 获得安装包