欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Ruby on Rails on Debian
来自开放百科 - 灰狐
目录 |
安装Ruby,Rails
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
从 http://rubyforge.org/frs/?group_id=307 获得安装包
如:rails-0.14.4.tgz
tar zxvf rails-0.14.4.tgz
cd rails
ruby script/server
http://locahost:3000 :) OK
推荐安装方式
从 http://ww.ruby-lang.org/en 获得 ruby tar zxvf ruby-x.y.z.tar.gz cd ruby-x.y.z ./configure make make test make install
从http://rubygems.rubyforge.org 获得 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
Apache
修改 vi /etc/apache2/sites-enabled/000-default
Alias /yourapp/ "/var/www/rails/yourapp/public/" <Location /yourapp/> Options ExecCGI FollowSymLinks AddHandler cgi-script .cgi AllowOverride all Order allow,deny Allow from all </Location>
/etc/init.d/apache2 restart
http://localhost/rails/yourapp/public/ :)
Lighttpd
Database
- libmysql-ruby
- libpgsql-ruby
- libsqlite3-ruby
# apt-get install libpgsql-ruby # irb irb(main):001:0> require 'postgres' => true irb(main):002:0> exit
RadRails
从 http://www.radrails.org/ 获得安装包
参考资料
Ruby on Rails on Debian
分享您的观点