Ruby FastCGI lighttpd mysql

#cd /usr/src
#export PATH=”/usr/local/bin:/usr/local/sbin:$PATH”
// 安装 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|我使用yum install zlib1g-dev
|————————–|
没用apt-get这个命令
// 安装apt-get
#wget http://ftp.freshrpms.net/pub/freshrpms/redhat/9/apt/apt-0.5.5cnc6-fr1.i386.rpm
#rpm -ivh apt-0.5.5cnc6-fr1.i386.rpm
#apt-get update
// 安装 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://rubyforge.iasi.roedu.net/files/rubygems/rubygems-0.9.0.tgz
#tar xzvf rubygems-0.9.0.tgz
#cd rubygems-0.9.0
#sudo /usr/local/bin/ruby setup.rb
#sudo gem install rubygems-update
#cd ..
可能出现的错误
ERROR: While executing gem … (SocketError)
getaddrinfo: Temporary failure in name resolution
// 安装 Ruby on Rails
#sudo gem install rails –include-dependencies
可能出现的错误 (ia64-linux)
ERROR: While executing gem … (Zlib::GzipFile::CRCError)
invalid compressed data — crc error

//安装 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
—–利用
#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 /usr/ports/www/fcgi
#make install
#cd ruby-fcgi-0.8.6
#/usr/local/bin/ruby install.rb config — \ –with-fcgi-include=/usr/local/include \ –with-fcgi-lib=/usr/local/lib
#/usr/local/bin/ruby install.rb setup
#/usr/local/bin/ruby install.rb install
// 安装 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/network/http/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
ERROR: Interrupted
ERROR: While executing gem … (SocketError)
getaddrinfo: Temporary failure in name resolution
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
如果出现
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.

Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
|——————————————|
|#sudo apt-get install libmysql-ruby |
|#sudo apt-get install libmysqlclient15-dev|
|——————————————|
#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
#vi /usr/local/ruby/application/config
#vi /usr/local/ruby/application/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 的环境安装好了。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.