Install Ruby Rails Lighttpd MySQL on Ubuntu or FreeBSD

来自开放百科 - 灰狐
2006年7月16日 (日) 21:20WikiSysop (讨论 | 贡献)的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到: 导航, 搜索

在 Ubuntu 5.04(FreeBSD 5.5)上安装 Ruby, Rails, Lighttpd, MySQL

此方法也适用于其它Linux,UNIX和BSD系统, 大家只需要修改其中的一些步骤。

// 安装 readline

wget ftp://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz

tar xzvf readline-5.1.tar.gz

cd readline-5.1

./configure –prefix=/usr/local

make

sudo make install

cd ..

// 安装 ruby

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.4.tar.gz

tar xzvf ruby-1.8.4.tar.gz

cd ruby-1.8.4

./configure –prefix=/usr/local –enable-pthread –with-readline-dir=/usr/local

make

sudo make install

cd ..

// 安装 ruby-zlib

wget http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz

tar zxvf ruby-zlib-0.6.0.tar.gz

cd ruby-zlib-0.6.0

/usr/local/bin/ruby extconf.rb

make

sudo make install

// 安装 rubygems

wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz

tar xzvf rubygems-0.8.11.tgz

cd rubygems-0.8.11

sudo /usr/local/bin/ruby setup.rb

cd ..

// 安装 Ruby on Rails

sudo /usr/local/bin/gem install rails –include-dependencies

// install FastCGI

wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz

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 http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gz

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 ..

sudo /usr/local/bin/gem install fcgi

// 安装 PCRE

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-6.6.tar.gz

tar xzvf pcre-6.6.tar.gz

cd pcre-6.6

./configure –prefix=/usr/local CFLAGS=-O1

make

sudo make install

cd ..

// 安装 lighttpd

wget http://lighttpd.net/download/lighttpd-1.4.11.tar.gz

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 ..

// 安装 mysql

省略 MySQL 的安装

// 绑定 mysql

sudo gem install mysql — –with-mysql-dir=/usr/local/mysql

Select which gem to install for your platform (i686-linux)

1. mysql 2.7.1 (mswin32)

2. mysql 2.7 (ruby)

3. mysql 2.6 (ruby)

4. mysql 2.5.1 (ruby)

5. Cancel installation

> 2 // 选择2

make install

mkdir -p /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib

/usr/bin/install -c -m 0755 mysql.so /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib

Successfully installed mysql-2.7

// 创建第一个Ruby on Rails应用

sudo mkdir /usr/local/ruby

sudo /usr/local/bin/rails usr/local/ruby/application

cd usr/local/ruby/application

sudo /usr/local/bin/ruby script/server

cp usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/configs/lighttpd.conf to

/usr/local/ruby/application/config 并修改 lighttpd.conf

启动 ruby

ruby 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 server

http://localhost

OK 一切顺利,Ruby 的环境安装好了。

——————————– 在 FreeBSD 5.5 上主要是 FastCGI 的安装有些不同,其它步骤和方法均保持不变

Install fcgi-devkit:

cd /usr/ports/www/fcgi

make install

cd ruby-fcgi-0.8.6

ruby install.rb config — \

–with-fcgi-include=/usr/local/include \

–with-fcgi-lib=/usr/local/lib

ruby install.rb setup

ruby install.rb install

这些步骤也在 FreeBSD 5.5 测试通过 :)

参考资料

Building Ruby, Rails, LightTPD, and MySQL on Tiger

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱