Ruby FastCGI lighttpd mysql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#cd /usr/src  
#export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
// 安装 readline
#wget [http://download.huihoo.com/ruby/readline-5.1.tar.gz](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](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](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](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](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](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](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](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](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 的安装

1
2
3
4
5
6
7
8
9
10
11
12
// 绑定 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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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](http://127.0.0.1/)
\=> Call with -d to detach
\=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)

此时启动了 Lighttpd web server
http://localhost
OK 一切顺利,Ruby 的环境安装好了。


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!