欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Install Ruby Rails Lighttpd MySQL on Ubuntu or FreeBSD
在 Ubuntu 5.04(FreeBSD 5.5)上安装 Ruby, Rails, Lighttpd, MySQL
此方法也适用于其它Linux,UNIX和BSD系统, 大家只需要修改其中的一些步骤。
// 安装 readline
wget http://download.huihoo.com/ruby/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 http://download.huihoo.com/ruby/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 ..
# RubyGems depends on zlib apt-get install zlib1g-dev
// 安装 ruby-zlib
wget http://download.huihoo.com/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://download.huihoo.com/ruby/rubygems-0.8.11.tgz
tar xzvf rubygems-0.8.11.tgz
cd rubygems-0.8.11
sudo /usr/local/bin/ruby setup.rb
sudo gem install rubygems-update
cd ..
// 安装 Ruby on Rails
sudo /usr/local/bin/sudo gem install rails –include-dependencies 或 sudo gem install rails
可能出现的错误 (ia64-linux)
ERROR: While executing gem ... (Zlib::GzipFile::CRCError) invalid compressed data -- crc error
// install FastCGI
wget http://download.huihoo.com/ruby/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://download.huihoo.com/ruby/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 http://download.huihoo.com/ruby/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://download.huihoo.com/lighttpd/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
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 测试通过 :)
参考资料