centos+nginx+ruby(and rails)+mongrel+php+mysql centos安装php常见错误

如果出现configure: error: Cannot find OpenSSL’s
<evp.h>错误,则:
yum install openssl openssl-devel

pengdunshiyoudeiMac:~ pdsy$ ruby -v

Sets the number of server processes created on startup.
Used only when ‘apache-like’ pm_style is selected
<value name=”StartServers”>20</value>

activesupport (5.0.0.1)

</value>

io-console (default: 0.4.3)

输入以下内容(如果您安装 Nginx + PHP 用于程序调试,请将以下的<value
name=”display_errors”>0</value>改为<value

1.1.1

3、编译安装PHP(FastCGI模式)
安装php前的预装库:
libxml2 libxml2-devel
openssl openssl-devel
curl curl-devel
libjpeg libjpeg-devel
libpng libpng-devel
freetype freetype-devel
gd gd-devel
(yum -y install gd
yum -y install gd-devel)
yum -y install openldap
yum -y install openldap-devel

executable-hooks (1.3.2)

Sets the desired minimum number of idle server processes.
Used only when ‘apache-like’ pm_style is selected
<value name=”MinSpareServers”>5</value>

from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in
`gem’

</value>

rubygems-bundler (1.4.4)

mysqli=/usr/local/mysql/bin/mysql_config –with-iconv-dir=/usr/local
–with-freetype-dir –with-jpeg-dir –with-png-dir –

然后查看 gem -v

执行./installer安装ruby完成后,提示如下信息:
/*
Installing useful libraries…
/usr/local/ruby/bin/ruby /usr/local/ruby/bin/gem sources –update
ERROR:  While executing gem … (Gem::RemoteFetcher::FetchError)
too many connection resets
(http://production.s3.rubygems.org/specs.4.8.gz)
——————————————–
Warning: some libraries could not be installed
The following gems could not be installed, probably because of an
Internet
connection error:

4.查询ruby 镜像

# wget
http://rubyforge.org/frs/download.php/76017/redmine-1.4.0.tar.gz
# /usr/sbin/adduser redmine
#mysql -u root -p
mysql> create database redmine character set utf8;
mysql> grant all on redmine.* to ‘redmine’@’localhost’ identified by
‘yourpassword’;
mysql> flush privileges;

from /usr/local/Library/Homebrew/utils.rb:6:in `<top(required)>’

启动mongrel:
#cd /mnt/htdocs/xhb
#mongrel_rails cluster::configure -e production -p 8000 -N 4 -c
/mnt/htdocs/xhb -a 127.0.0.1 -user mongrel -group mongrel
在当前工程的目录 config 下生成一个mongrel_cluster.yml 配置文件:
#vi config/mongrel_cluster.yml
把user:改为user:mongrel
把group:改为group:mongrel
执行下面命令就可以启动 Mongrel 集群:
#mongrel_rails cluster::start
#mongrel_rails cluster::stop

pengdunshiyoudeiMac:local pdsy$ gem uninstall cocoapods -v 0.39.0

Comma separated list of ipv4 addresses of FastCGI clients that allowed
to connect.
Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi
(5.2.2+)
Makes sense only with AF_INET listening socket.
<value name=”allowed_clients”>127.0.0.1</value>

2.查询ruby版本

vi /mnt/mysql/3306/mysql

bundler-unload (1.0.2)

wget
http://blog.s135.com/soft/linux/nginx\_php/imagick/ImageMagick.tar.gz
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
cd ../

from /usr/local/bin/pod:22:in `’

安装 ruby mysql 支持
# /usr/local/ruby/bin/gem install mysql
安装mysql支持出错:
Building native extensions.  This could take a while…
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

rvm install ruby 2.2.2

with-openssl –with-mhash –enable-pcntl –enable-sockets –with-ldap
–with-ldap-sasl –with-xmlrpc –enable-zip –enable-

thread_safe (0.3.5)

Additional php.ini defines, specific to this pool of workers.
<value name=”php_defines”>
<value name=”sendmail_path”>/usr/sbin/sendmail -t
-i</value>
<value name=”display_errors”>0</value>
</value>

*** LOCAL GEMS ***

安装gcc
yum -y install gcc

现找一下 pod的路径

/*以下的步骤这样没有配置成功

gem -v

在php.ini中加上
extension=imagick.so

http://gems.ruby-china.org/added
to sources

The timeout (in seconds) for serving a single request after which the
worker process will be terminated
Should be used when ‘max_execution_time’ ini option does not stop
script execution for some reason
’0s’ means ‘off’
<value name=”request_terminate_timeout”>0s</value>

/Library/Ruby/Site/2.0.0/rubygems.rb:250:in `find_spec_for_exe’:
can’t find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)

vi /usr/local/php/etc/php.ini
按shift+g键跳到配置文件的最末尾,加上以下配置信息:
[eaccelerator]
zend_extension=”/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so”
eaccelerator.shm_size=”64″
eaccelerator.cache_dir=”/tmp/eaccelerator_cache”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”3600″
eaccelerator.shm_prune_period=”3600″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

1.查询 rvm版本

#log-slow-queries = /mnt/mysql/3306/slow.log
#long_query_time = 10

Password:

–enable-fpm –enable-force-cgi-redirect –enable-cgi –enable-mbstring
–with-mcrypt –with-gd –enable-gd-native-ttf –

rubygems-update (2.6.8)

④、创建管理MySQL数据库的shell脚本:

json (default: 1.8.1)

安装g++
yum install gcc-c++

i18n (0.7.0)

Edition in combination with Phusion Passenger and Ruby on Rails, which
do require one or more of the aforementioned gems, so

pengdunshiyoudeiMac:~ pdsy$ gem sources
–removehttps://ruby.taobao.org/

再查找; cgi.fix_pathinfo=0
修改为cgi.fix_pathinfo=0,防止Nginx文件类型错误解析漏洞。

最后添加几个参考地址:

ruby企业版(http://www.rubyenterpriseedition.com/download.html )
wget
http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz
tat zxvf ruby-enterprise-1.8.7-2012.02.tar.gz
cd ruby-enterprise-1.8.7-2012.02.tar.gz
./installer
如果出现 GNU Readline development headers… not found,则需要安装yum
install readline-devel
安装企业版RubyGems会被自动安装进去。

rake (default: 10.4.2)

安装和配置 Mongrel
#gem install mongrel mongrel_cluster –include-dependencies
#ln -s
/usr/local/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails
/usr/bin/mongrel_rails
#ln -s /usr/local/ruby/bin/mongrel_rails 
/usr/local/bin/mongrel_rails

pengdunshiyoudeiMac:local pdsy$ sudo gem install cocoapods

如果出现
configure: error: Please reinstall the libcurl distribution –
easy.h should be in <curl-dir>/include/curl/
错误,则:
yum install curl curl-devel

psych (default: 2.0.8)

centos安装nginx php ruby
1、编译安装PHP 5.3.10所需的支持库
cd /root/software

ruby -v

# /usr/local/ruby/bin/gem sources -r http://gems.rubyforge.org/
#/usr/local/ruby/bin/gem sources -a
http://gems.tron.name/gems.rubyforge.org/

获取gem

连接本机上的mysql:
/usr/local/mysql/bin/mysql -u root -p
退出mysql: exit;

pengdunshiyoudeiMac:local pdsy$ gem uninstall cocoapods-core -v 0.39.0

Address to accept fastcgi requests on.
Valid syntax is ‘ip.ad.re.ss:port’ or just ‘port’ or
‘/path/to/unix/socket’
<value name=”listen_address”>127.0.0.1:9000</value>

rvm (1.11.3.9)

function_restart_mysql()
{
printf “Restarting MySQL…\n”
function_stop_mysql
sleep 5
function_start_mysql
}

minitest (5.4.3)

Process manager settings
<value name=”pm”>

公司的电脑出现了

PHP编译configure:
error集合http://blog.sina.com.cn/s/blog\_7e4c8f2b0100v39j.html

8.更换镜像地址 成腾讯云  淘宝镜像好像不行了

5、修改php.ini文件
手工修改:查找/usr/local/php/etc/php.ini中的extension_dir = “./”
修改为extension_dir =
“/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/”
并在此行后增加以下几行,然后保存:
extension = “memcache.so”
extension = “pdo_mysql.so”
extension = “imagick.so”

from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in
`to_spec’

通上以上信息显示一些组件没有安装,所以运行以下命令:
/usr/local/ruby/bin/gem install passenger
/usr/local/ruby/bin/gem install rake
usr/local/ruby/bin/gem install rails -v 2.3.9
/usr/local/ruby/bin/gem install bundler

然后下面我直接安装了cocoapod

安装ruby完毕。

6.再次查询 看看升级成功

When this amount of php processes exited with SIGSEGV or SIGBUS …
<value name=”emergency_restart_threshold”>10</value>

ffi (1.9.14)

4、编译安装PHP5扩展模块  
(http://www.dankypang.com/2011/02/%E5%AE%89%E8%A3%85-memcache-2-2-6-tgz-php/)
memcached
是一个Linux下的缓存服务器,可以将内存划出一块来做为缓存使用。

3.查询 gem 版本

… in a less than this interval of time, a graceful restart will be
initiated.
Useful to work around accidental curruptions in accelerator’s shared
memory.
<value name=”emergency_restart_interval”>1m</value>

concurrent-ruby (1.0.2)

/usr/local/mysql/bin/mysql -u root -p -S /tmp/mysql.sock

22 gems installed

输入如下内容:

tzinfo (1.2.2)

执行/usr/local/php/bin/phpize时如果出现
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
错误,则需要安装m4 autoconf 
(http://www.workle.cn/space.php?uid=1&do=blog&id=296)
yum install m4
yum install autoconf

rvm -v

如果出现
Configure: error: libpng.(also) not found.
错误,则:yum install libpng libpng-devel

这个错误

2、安装mysql            
http://www.cnblogs.com/Jeffreyliang/archive/2011/06/04/2040628.html
wget http://mysql.easynet.be/Downloads/MySQL-5.1/mysql-5.1.62.tar.gz
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar zxvf mysql-5.1.62
cd mysql-5.1.62/
./configure –prefix=/usr/local/mysql –with-extra-charsets=all
–with-unix-socket-path=/usr/local/mysql/var/mysql.sock –

9.最后升级 cocoaPods

end

为了让 Mongrel 集群在每次开机都能自动启动,把 mongrel_cluster
作为服务
#mkdir /etc/mongrel_cluster
#ln -s /mnt/htdocs/xhb/config/mongrel_cluster.yml
/etc/mongrel_cluster/xhb.yml
#cp
/usr/local/ruby/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/resources/mongrel_cluster
/etc/init.d/
#chmod +x /etc/init.d/mongrel_cluster
#ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
#ln -s /usr/local/ruby/bin/mongrel_rails /usr/bin/mongrel_rails
#ln -s /usr/local/ruby/bin/mongrel_cluster_ctl
/usr/bin/mongrel_cluster_ctl
#chkconfig –level 345 mongrel_cluster on

注:如果执行 service mongrel_cluster start 出现“/usr/bin/env: ruby:
权限不够”的错误,就要检查工程 public 下的 dispatch.*

文件用户是否有执行权限
$ chmod 755 /var/www/business/public/dispatch.cgi
$ chmod 755 /var/www/business/public/dispatch.fcgi
$ chmod 755 /var/www/business/public/dispatch.rb
将三个文件的第一行指向 ruby 的安装路径 #!/usr/local/ruby/bin/ruby
打开 /usr/bin/mongrel_cluster_ctl 文件,如果第一行代码为
#!/usr/bin/env ruby,改为 !/usr/local/ruby/bin/ruby,上面的链接已经

建立后,也可以改为 #!/usr/bin/ruby

启动 mongrel:
# /etc/init.d/mongrel_cluster start

参考:Nginx + Mongrel Cluster 在 CentOS 上部署 ROR
(http://brian80s.iteye.com/blog/645251)

http://magicgod.iteye.com/blog/153779

http://www.vpsee.com/2009/11/install-nginx-mongrel-rails-on-centos/

http://www.worldhello.net/2010/06/09/1347.html

http://hi.baidu.com/ge\_geshuai/blog/item/2f05eb5c3629ad4ffbf2c029.html

http://www.rubyenterpriseedition.com/download.html

http://blog.sina.com.cn/s/blog\_3d4a28be0100s4u1.html

http://www.freshblurbs.com/installing-ruby-rails-3-centos-nginx

http://blog.s135.com/nginx\_php\_v6/

./rails server 起动ruby程序时出错
iconv.so: libiconv.so.2: cannot open shared object file: No such file or
directory
解决:ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2

出错:execjs/runtimes.rb:50:in `autodetect’: Could not find a
JavaScript runtime
解决:http://rubyer.me/blog/740/

三、安装Nginx 0.8.46
1、安装Nginx所需的pcre库:
tar zxvf pcre-8.10.tar.gz
cd pcre-8.10/
./configure
make && make install
cd ../
或者直接用 yum install pcre pcre-devel来安装。

2、安装Nginx
tar zxvf nginx-0.8.46.tar.gz
cd nginx-0.8.46/
./configure –user=www –group=www –prefix=/usr/local/nginx
–sbin-path=/usr/local/nginx/sbin/nginx –with-

http_stub_status_module –with-http_ssl_module
–without-mail_pop3_module –without-mail_imap_module –without-

mail_smtp_module –with-http_realip_module
make && make install
cd ../

cd /usr/local/ruby/bin
./passenger-install-nginx-module

Configure Firewall
vi /etc/sysconfig/iptables-config
IPTABLES_SAVE_ON_STOP=“yes”
IPTABLES_SAVE_ON_RESTART=“yes”

Open Web ports:
/sbin/iptables -I INPUT -p tcp -m state –state NEW,ESTABLISHED –dport 80
-j ACCEPT
/sbin/iptables -I INPUT -p tcp -m state –state NEW,ESTABLISHED –dport
443 -j ACCEPT

3、创建Nginx日志目录
mkdir -p /mnt/logs
chmod +w /mnt/logs
chown -R www:www /mnt/logs

4、创建Nginx配置文件
①、在/usr/local/nginx/conf/目录中创建nginx.conf文件:
rm -f /usr/local/nginx/conf/nginx.conf
vi /usr/local/nginx/conf/nginx.conf
输入以下内容:

user  www www;

worker_processes 8;

error_log  /data1/logs/nginx_error.log  crit;

pid        /usr/local/webserver/nginx/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by
this process.
worker_rlimit_nofile 65535;

events
{
use epoll;
worker_connections 65535;
}

http
{
include       mime.types;
default_type  application/octet-stream;

#charset  gb2312;

server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;

sendfile on;
tcp_nopush     on;

keepalive_timeout 60;

tcp_nodelay on;

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_88bf必发娱乐,write_size 128k;

gzip on;
gzip_min_length  1k;
gzip_buffers     4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types       text/plain application/x-javascript text/css
application/xml;
gzip_vary on;

#limit_zone  crawler  $binary_remote_addr  10m;

server
{
listen       80;
server_name  blog.s135.com;
index index.html index.htm index.php;
root  /data0/htdocs/blog;

#limit_conn   crawler  20;

location ~ .*\.(php|php5)?$
{
#fastcgi_pass  unix:/tmp/php-cgi.sock;
fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires      30d;
}

location ~ .*\.(js|css)?$
{
expires      1h;
}

log_format  access  ‘$remote_addr – $remote_user [$time_local]
“$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” $http_x_forwarded_for’;
access_log  /data1/logs/access.log  access;
}

server
{
listen       80;
server_name  www.s135.com;
index index.html index.htm index.php;
root  /data0/htdocs/www;

location ~ .*\.(php|php5)?$
{
#fastcgi_pass  unix:/tmp/php-cgi.sock;
fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}

log_format  wwwlogs  ‘$remote_addr – $remote_user [$time_local]
“$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” $http_x_forwarded_for’;
access_log  /data1/logs/wwwlogs.log  wwwlogs;
}

server
{
listen  80;
server_name  status.blog.s135.com;

location / {
stub_status on;
access_log   off;
}
}
}

②、在/usr/local/nginx/conf/目录中创建fcgi.conf文件:
vi /usr/local/nginx/conf/fcgi.conf
输入以下内容:
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_FILENAME   
$document_root$fastcgi_script_name;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with –enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

5、启动Nginx
ulimit -SHn 65535
/usr/local/nginx/sbin/nginx

四、配置开机自动启动Nginx + PHP
vi /etc/rc.local
在末尾增加以下内容:
ulimit -SHn 65535
/usr/local/php/sbin/php-fpm start
/usr/local/webserver/nginx/sbin/nginx

五、优化Linux内核参数
vi /etc/sysctl.conf
在末尾增加以下内容:
# Add
net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog =  32768
net.core.somaxconn = 32768

net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216

net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2

net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800

#net.ipv4.tcp_fin_timeout = 30
#net.ipv4.tcp_keepalive_time = 120
net.ipv4.ip_local_port_range = 1024  65535

使配置立即生效:
/sbin/sysctl -p

Ruby on Rails
mysql数据库连接过程的中的小记录http://www.cnblogs.com/keen-allan/archive/2012/04/22/2465269.html

Nginx vhost EG:

server
{
listen       80;
server_name blog.xhuoban.com blog2.xhuoban.com;
root   /var/www/xhb;
location / {
index  index.html index.htm index.php;
access_log off;
}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}
access_log  /var/log/nginx/Chongqing.log;
location ~ \.php$ {
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include        fastcgi_params;
}
rewrite ^/(.*)-htm-(.*)$ /$1.php?$2 last;
rewrite ^/(.*)/show-([0-9]+)([\-])?([0-9]+)?\.html$
/$1/show.php?itemid=$2&page=$4 last;
rewrite ^/(.*)/list-([0-9]+)([\-])?([0-9]+)?\.html$
/$1/list.php?catid=$2&page=$4 last;
rewrite ^/(.*)/show/([0-9]+)/([0-9]+)?([/])?$
/$1/show.php?itemid=$2&page=$3 last;
rewrite ^/(.*)/list/([0-9]+)/([0-9]+)?([/])?$
/$1/list.php?catid=$2&page=$3 last;
rewrite ^(.*)/([a-z]+)/(.*)\.shtml$ $1/$2/index.php?rewrite=$3
last;
rewrite ^/(com)/([a-z0-9_]+)/([a-z]+)/(.*)\.html$
/company/$3/index.php?homepage=$2&rewrite=$4 last;
rewrite ^/(com)/([a-z0-9_]+)/([a-z]+)([/])?$
/company/$3/index.php?homepage=$2 last;
rewrite ^/(com)/([a-z0-9_]+)([/])?$ /index.php?homepage=$2 last;
location /status {
stub_status on;
access_log  off;
}
}

参考:
本文讲述如何在Linux/Unix平台上面搭建Nginx+Mongrel
Cluster实现Rails高负载的应用。

http://rails-deployment.group.iteye.com/group/wiki/1264-nginx-mongrel-cluster-configuration-guide

启动mongrel:
/etc/init.d/mongrel_cluster start
出现以下错误
mongrel_cluster_ctl:6: command not found: mongrel_rails
解决:ln -s `find /usr/local -type f -name mongrel_rails
2>/dev/null | head -1` /usr/local/bin  (即:ln -s

/usr/local/ruby/bin/mongrel_rails  /usr/local/bin/mongrel_rails)

mongrel_rails cluster::configure -e production -p 8000 -N 4 -c
/mnt/htdocs/xhb -a 127.0.0.1 -user mongrel -group mongrel

rails3.2.3 使用mongrel出错:
dependencies.rb:251:in `require’: no such file to load — dispatcher
(LoadError)

http://forums.cpanel.net/f5/mongrel-issue-when-starting-ruby-applications-using-rails-3-0-case-43320-a-163993.html

ruby 1.8.7 Enterprise Edition 和 mongrel 配置时,
用gem 1.8.15会出现错误。应该使用gem 1.6.2。
(ruby 1.8.1 Enterprise + mongrel 1.1.5 + gem 1.6.2)
ruby 1.8.7 Enterprise Edition 不能使用gem 1.8.15.
如何更新到gem 1.6.2,命令:gem update –system 1.6.2

如果ruby 1.8.7 Enterprise Edition + gem 1.8.15,启动应用程序(ruby
script/server)会出现如下错误:
NOTE: Gem.source_index is deprecated, use Specification. It will be
removed on or after 2011-11-01.
Gem.source_index called from
/usr/local/ruby/lib/ruby/gems/1.8/gems/rails-2.3.9/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It
will be removed on or after 2011-11-01.
Gem::SourceIndex#refresh! called from
/usr/local/ruby/lib/ruby/gems/1.8/gems/rails-

2.3.9/lib/rails/vendor_gem_source_index.rb:34.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no
replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#load_gems_in called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:322.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use
Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from
/usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It
will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from
/usr/local/ruby/lib/ruby/gems/1.8/gems/rails-

2.3.9/lib/rails/vendor_gem_source_index.rb:100.

这时只需运行:gem update –system 1.6.2,即可。

Category: Liunx, Ruby

You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.

Comments are closed.


http://blog.csdn.net/wangyanchang21/article/details/51885383

Name of pool. Used in logs and stats.
<value name=”name”>default</value>

pods (0.0.1)

Pass environment variables like LD_LIBRARY_PATH
All $VARIABLEs are taken from current environment
<value name=”environment”>
<value name=”HOSTNAME”>$HOSTNAME</value>
<value name=”PATH”>/usr/local/bin:/usr/bin:/bin</value>
<value name=”TMP”>/tmp</value>
<value name=”TMPDIR”>/tmp</value>
<value name=”TEMP”>/tmp</value>
<value name=”OSTYPE”>$OSTYPE</value>
<value name=”MACHTYPE”>$MACHTYPE</value>
<value name=”MALLOC_CHECK_”>2</value>
</value>

bigdecimal (default: 1.2.6)

安装Memcached
memcache基于libevent构建,在装memcache之前需要安装libevent (yum -y
install libevent libevent-devel )
wget http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz  
(http://memcached.org/)
tar zxvf memcached-1.4.13.tar.gz
cd memcached-1.4.13
./configure –prefix=/usr/local/memcached
make && make install

power_assert (0.2.2)

/usr/local/ruby/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lmygcc… no
checking for mysql_query() in -lmysqlclient… no
*** extconf.rb failed ***

我就先把 gem 版本升级了

安装ruby   (nginx Mongrel)
先安装所需要的库
yum groupinstall “Development Tools”
yum install zlib-devel wget openssl-devel pcre pcre-devel make gcc
gcc-c++ curl-devel

然后下面是安装过程

To install the aforementioned gems, please use the following commands:
* /usr/local/ruby/bin/ruby /usr/local/ruby/bin/gem install passenger
* /usr/local/ruby/bin/ruby /usr/local/ruby/bin/gem install rake
* /usr/local/ruby/bin/ruby /usr/local/ruby/bin/gem install rails
* /usr/local/ruby/bin/ruby /usr/local/ruby/bin/gem install mysql
* /usr/local/ruby/bin/ruby /usr/local/ruby/bin/gem install bundler

rdoc (default: 4.2.0)

/usr/local/ruby

https://ruby.taobao.org/

interactive_timeout = 120
wait_timeout = 120

pengdunshiyoudeiMac:local pdsy$ gem list

If you have any questions, feel free to visit our website:

gem-wrappers (1.2.7)

function_kill_mysql()
{
kill -9 $(ps -ef | grep ‘bin/mysqld_safe’ | grep
${mysql_port} | awk ‘{printf $2}’)
kill -9 $(ps -ef | grep ‘libexec/mysqld’ | grep
${mysql_port} | awk ‘{printf $2}’)
}

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in
`to_specs’: Could not find ‘cocoapods’ (>= 0) among 25 total gem(s)
(Gem::LoadError)

libiconv库
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14/
./configure –prefix=/usr/local
make
make install
cd ../

/usr/local/bin/pod

wget
http://nchc.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar jxvf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1/
/usr/local/php/bin/phpize
./configure –enable-eaccelerator=shared
–with-php-config=/usr/local/php/bin/php-config
-with-eaccelerator-shared-memory
make
make install
cd ../

Successfully uninstalled cocoapods-core-0.39.0

/usr/local/ruby/bin/passenger-install-apache2-module

cocoa (0.1.6)

编译时出现错误集合:
如果出现 libxml错语提示:
请检查并安装libxml2
rpm -qa | grep libxml
yum install libxml2
yum install libxml2-devel

………….Done installing documentation for nanaimo, colored, claide,
CFPropertyList, activesupport, xcodeproj, nap, molinillo, gh_inspector,
fourflusher, escape, cocoapods-try, netrc, cocoapods-trunk,
cocoapods-stats, cocoapods-search, cocoapods-plugins,
cocoapods-downloader, cocoapods-deintegrate, fuzzy_match,
cocoapods-core, cocoapods after 15 seconds

新加载配置文件使用reload。

from /usr/local/bin/pod:22:in `’

skip-name-resolve
#master-connect-retry = 10
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396

pengdunshiyoudeiMac:~ pdsy$ gem sources -l

with-named-curses-libs=/usr/lib/libncursesw.so.5

这个错误

How much requests each process should execute before respawn.
Useful to work around memory leaks in 3rd party libraries.
For endless request processing please specify 0
Equivalent to PHP_FCGI_MAX_REQUESTS
<value name=”max_requests”>1024</value>

pengdunshiyoudeiMac:local pdsy$ which pod

#master-host     =   192.168.1.2
#master-user     =   username
#master-password =   password
#master-port     =  3306

pengdunshiyoudeiMac:~ pdsy$ sudo gem  install -n /usr/local/bin cocoa
pods//这个地方不能用之前旧的更新方法:sudo gem installcocoa pods

输入以下内容:

最后检查一下版本

新增系统用户 mongrel,并把工程目录的权限赋予 mongrel
#adduser -r mongrel (/usr/sbin/adduser)
#chown -R mongrel:mongrel /mnt/htdocs/xhb

ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]

8、创建php-fpm配置文件(php-fpm是为PHP打的一个FastCGI管理补丁,可以平滑变更php.ini配置而无需重启php-cgi):
在/usr/local/php/etc/目录中创建php-fpm.conf文件:
rm -f /usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf

pengdunshiyoudeiMac:local pdsy$ gem -v

Unix user of processes
<value name=”user”>www</value>

gem update —system

Sets the limit on the number of simultaneous requests that will be
served.
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used with any pm_style.
<value name=”max_children”>128</value>

5.升级ruby环境到 2.2.2  ,

function_start_mysql()
{
printf “Starting MySQL…\n”
/bin/sh /usr/local/mysql/bin/mysqld_safe
–defaults-file=/mnt/mysql/${mysql_port}/my.cnf 2>&1 > /dev/null
&
}

http://www.cocoachina.com/bbs/read.php?tid-1678150.html

All relative paths in this config are relative to php’s install prefix

Successfully uninstalled cocoapods-0.39.0

mcrypt库
wget
http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../

http://blog.csdn.net/xingxingrainlove/article/details/53257944

Sets the desired maximum number of idle server processes.
Used only when ‘apache-like’ pm_style is selected
<value name=”MaxSpareServers”>35</value>

pengdunshiyoudeiMac:local pdsy$ pod –version

Gem files will remain installed in
/usr/local/ruby/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to
/usr/local/ruby/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

pengdunshiyoudeiMac:~ pdsy$ gem sources
-ahttp://gems.ruby-china.org/

建立缓存文件夹,设置文件夹权限:
mkdir /tmp/eaccelerator_cache
chmod 0777 /tmp/eaccelerator_cache

移除程序包

Updating /usr/local/ruby/bin/gem…
Updating /usr/local/ruby/bin/irb…
Updating /usr/local/ruby/bin/erb…
Updating /usr/local/ruby/bin/testrb…
Updating /usr/local/ruby/bin/ri…
Updating /usr/local/ruby/bin/rdoc…
——————————————–
Ruby Enterprise Edition is successfully installed!
If want to use Phusion Passenger (http://www.modrails.com) in
combination
with Ruby Enterprise Edition, then you must reinstall Phusion Passenger
against
Ruby Enterprise Edition, as follows:

最终完成了

⑤、赋予shell脚本可执行权限:

test-unit (3.0.8)

<section name=”pool”>

*** CURRENT SOURCES ***

Set to ‘no’ to debug fpm
<value name=”daemonize”>yes</value>

pengdunshiyoudeiMac:local pdsy$ sudo rm -rf /usr/local/bin/pod

[client]
character-set-server = utf8
port    = 3306
socket  = /tmp/mysql.sock

7.查询镜像

</section>

https://ruby.taobao.org/removed
from sources

⑥、启动MySQL:

这时候 我从网上看到一位朋友给的解决办法 我就粘贴了试了试
下面是我公司电脑出的错误 , 上面2个错误的解决办法是一样的

注:/usr/local/php/sbin/php-fpm还有其他参数,包括:start|stop|quit|restart|reload|logrotate,修改php.ini后不重启php-cgi,重

如果成功以后 可以 pod —version 查询一下版本 但是 我自己的电脑 出现了

结束服务 kill `cat /tmp/memcached.pid`

gem sources -l

启动mongrel(mongrel_rails
cluster::start)出错,mongrel.8000.log显示如下错误:
Error calling Dispatcher.dispatch #<NoMethodError: You have a nil
object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split
cgi_process.rb:54:in `dispatch_cgi’
解决:(http://www.pcoder.net/error-calling-dispatcher-dispatch/\#axzz1p21cqkK1)

在这里我没有输出 正常的会有输出

附:以下为附加步骤,如果你想在这台服务器上运行MySQL数据库,则执行以下几步。如果你只是希望让PHP支持MySQL扩展库,能够连接其他

2.6.8

server-id = 1

from /Library/Ruby/Site/2.0.0/rubygems.rb:278:in `activate_bin_path’

with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath
–enable-discard-path –enable-safe-mode –enable-bcmath –

删除目录下的文件

[mysqldump]
quick
max_allowed_packet = 32M

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
`require’: cannot load such file — utils/popen (LoadError)

Settings group for ‘apache-like’ pm style
<value name=”apache_like”>

from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
`require’

</configuration>

修改php的配置文件,php.ini
vi /usr/local/php/etc/php.ini
查找:extension_dir = “./”
修改成:
extension_dir =
“/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/”
extension=memcache.so

http://www.rubyenterpriseedition.com

Set max core size rlimit
<value name=”rlimit_core”>0</value>

mhash库
wget
http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../

function_stop_mysql()
{
printf “Stoping MySQL…\n”
/usr/local/mysql/bin/mysqladmin -u ${mysql_username}
-p${mysql_password} -S /tmp/mysql.sock shutdown
}

cd /root/software/ruby-enterprise-1.8.7-2012.02/source/ext/zlib/
/usr/local/ruby/bin/ruby extconf.rb –with-zlib-include=/usr/include/
–with-zlib-lib=/usr/lib
cd ../../
make
make install
(参考:http://www.vpsee.com/2009/11/centos-install-redmine-git/)

tar zxvf php-5.3.10.tar.gz
cd php-5.3.10
./configure –prefix=/usr/local/php
–with-config-file-path=/usr/local/php/etc –with-mysql=/usr/local/mysql
–with-

Enjoy Ruby Enterprise Edition, a product of Phusion (www.phusion.nl)
88bf必发娱乐 1+mongrel+php+mysql%E4%B8%80%E8%B7%AF%E5%9D%8E%E5%9D%B7.files/icon_smile.gif)

Unix group of processes
<value name=”group”>www</value>

解决(这样执行):
/usr/local/ruby/bin/gem install mysql —
–with-mysql-config=/usr/local/mysql/bin/mysql_config
或:不安装手册
/usr/local/ruby/bin/gem install –no-rdoc –no-ri mysql —
–with-mysql-config=/usr/local/mysql/bin/mysql_config

服务器上的MySQL数据库,那么,以下两步无需执行。
①、创建MySQL数据库存放目录
mkdir -p /mnt/mysql/3306/data/
mkdir -p /mnt/mysql/3306/binlog/
mkdir -p /mnt/mysql/3306/relaylog/
chown -R mysql:mysql /mnt/mysql/

安装完成,运行一下(启动memcached):
/usr/local/memcached/bin/memcached -d -m 10 -u root -l 127.0.0.1 -p
11211 -c 256 -P /tmp/memcached.pid
说明:
-d选项是启动一个守护进程,
-m是分配给Memcache使用的内存数量,单位是MB,我这里是10MB,
-u是运行Memcache的用户,我这里是root
-l是监听的服务器IP地址,如果有多个地址的话,我这里指定了服务器的IP地址192.168.0.200,
-p是设置Memcache监听的端口,我这里设置了12000,最好是1024以上的端口,
-c选项是最大运行的并发连接数,默认是1024,我这里设置了256,按照你服务器的负载量来设定,
-P是设置保存Memcache的pid文件,我这里是保存在 /tmp/memcached.pid

⑨、(可选)停止MySQL:
/mnt/mysql/3306/mysql stop

The timeout (in seconds) for serving of single request after which a php
backtrace will be dumped to slow.log file
’0s’ means ‘off’
<value name=”request_slowlog_timeout”>0s</value>

/mnt/mysql/3306/mysql start

<workers>

you may want to install them later.

Chroot to this directory at the start, absolute path
<value name=”chroot”></value>

If you ever want to uninstall Ruby Enterprise Edition, simply remove
this
directory:

安装 ruby on rails,指定版本号。安装前先检查是否已经安装过。
#gem list | grep rails
#gem install rails -v 2.3.9
删除rails:
gem uninstall -v 3.0.0 rails
gem uninstall -v 3.0.0 actionmailer
gem uninstall -v 3.0.0 railties
gem uninstall -v 3.0.0 actionpack
gem uninstall -v 3.0.0 activerecord
gem uninstall -v 3.0.0 activemodel
gem uninstall arel
gem uninstall -v 3.0.0 activesupport

http://sourceforge.net/projects/eaccelerator/

Set open file desc rlimit
<value name=”rlimit_files”>65535</value>

wget http://pecl.php.net/get/imagick-3.0.1.tgz
tar zxvf imagick-3.0.1.tgz
cd imagick-3.0.1/
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
make
make install
cd ../

再查找output_buffering = Off
修改为output_buffering = On

chmod +x /mnt/mysql/3306/mysql

③、创建my.cnf配置文件:
vi /mnt/mysql/3306/my.cnf

如果出现
configure: error: jpeglib.h not found.
错误,则:yum install libjpeg libjpeg-devel

configure: error: freetype.h not found.
yum -y install freetype freetype-devel

⑧、输入以下SQL语句,创建一个具有root权限的用户(admin)和密码(123456):
GRANT ALL PRIVILEGES ON *.* TO ‘admin’@’localhost’ IDENTIFIED BY
’123456′;
GRANT ALL PRIVILEGES ON *.* TO ‘admin’@’127.0.0.1′ IDENTIFIED BY
’123456′;

#!/bin/sh

<value name=”listen_options”>

⑦、通过命令行登录管理MySQL服务器(提示输入密码时直接回车):

Log level
<value name=”log_level”>notice</value>

# ruby setup.rb

Chdir to this directory at the start, absolute path
<value name=”chdir”></value>

Set permissions for unix socket, if one used.
In Linux read/write permissions must be set in order to allow
connections from web server.
Many BSD-derrived systems allow connections regardless of permissions.
<value name=”owner”></value>
<value name=”group”></value>
<value name=”mode”>0666</value>
</value>

</workers>

在应用程序目录下创建config/initializers/mongrel.rb文件,内容为如下代码:

if Rails.version == ’2.3.9′ && Gem.available?(‘mongrel’,
Gem::Requirement.new(‘~>1.1.5′)) && self.class.const_defined?

(:Mongrel)

# Pulled right from latest rack. Old looked like this in 1.1.0
version.
#
# def [](k)
# super(@names[k] ||= @names[k.downcase])
# end
#
module Rack
module Utils
class HeaderHash < Hash
def [](k)
super(@names[k]) if @names[k]
super(@names[k.downcase])
end
end
end
end

# Code pulled from the ticket above.
#
class Mongrel::CGIWrapper
def header_with_rails_fix(options = ‘text/html’)
@head[‘cookie’] = options.delete(‘cookie’).flatten.map { |v|
v.sub(/^\n/,”) } if options.class != String and

options[‘cookie’]
header_without_rails_fix(options)
end
alias_method_chain :header, :rails_fix
end

# Pulled right from 2.3.9 ActionPack. Simple diff was
#
# if headers.include?(‘Set-Cookie’)
# headers[‘cookie’] = headers.delete(‘Set-Cookie’).split(“\n”)
# end
#
# to
#
# if headers[‘Set-Cookie’]
# headers[‘cookie’] = headers.delete(‘Set-Cookie’).split(“\n”)
# end
#
module ActionController
class CGIHandler
def self.dispatch_cgi(app, cgi, out = $stdout)
env = cgi.__send__(:env_table)
env.delete “HTTP_CONTENT_LENGTH”
cgi.stdinput.extend ProperStream
env[“SCRIPT_NAME”] = “” if env[“SCRIPT_NAME”] == “/”
env.update({
“rack.version” => [0,1],
“rack.input” => cgi.stdinput,
“rack.errors” => $stderr,
“rack.multithread” => false,
“rack.multiprocess” => true,
“rack.run_once” => false,
“rack.url_scheme” => [“yes”, “on”, “1”].include?(env[“HTTPS”]) ?
“https” : “http”
})
env[“QUERY_STRING”] ||= “”
env[“HTTP_VERSION”] ||= env[“SERVER_PROTOCOL”]
env[“REQUEST_PATH”] ||= “/”
env.delete “PATH_INFO” if env[“PATH_INFO”] == “”
status, headers, body = app.call(env)
begin
out.binmode if out.respond_to?(:binmode)
out.sync = false if out.respond_to?(:sync=)
headers[‘Status’] = status.to_s
if headers[‘Set-Cookie’]
headers[‘cookie’] = headers.delete(‘Set-Cookie’).split(“\n”)
end
out.write(cgi.header(headers))
body.each { |part|
out.write part
out.flush if out.respond_to?(:flush)
}
ensure
body.close if body.respond_to?(:close)
end
end
end
end

②、以mysql用户帐号的身份建立数据表:
/usr/local/mysql/bin/mysql_install_db –basedir=/usr/local/mysql
–datadir=/mnt/mysql/3306/data –user=mysql

</section>

if [ “$1” = “start” ]; then
function_start_mysql
elif [ “$1” = “stop” ]; then
function_stop_mysql
elif [ “$1” = “restart” ]; then
function_restart_mysql
elif [ “$1” = “kill” ]; then
function_kill_mysql
else
printf “Usage: /mnt/mysql/${mysql_port}/mysql
{start|stop|restart|kill}\n”
fi

Memcache环境测试:
运行下面的php文件,如果有输出This is a
test!,就表示环境搭建成功。开始领略Memcache的魅力把!
< ?php
$mem = new Memcache;
$mem->connect(“127.0.0.1″, 11211);
$mem->set(‘key’, ‘This is a test!’, 0, 60);
$val = $mem->get(‘key’);
echo $val;
?>

These gems are not required, i.e. Ruby Enterprise Edition will work fine
without them. But most people use Ruby Enterprise

Sets style of controling worker process count.
Valid values are ‘static’ and
Apache-like’
<value name=”style”>static</value>

*/

Pid file
<value
name=”pid_file”>/usr/local/php/logs/php-fpm.pid</value>

6、配置eAccelerator加速PHP:

安装pdo_mysql:
wget http://pecl.php.net/get/PDO\_MYSQL-1.0.2.tgz
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
–with-pdo-mysql=/usr/local/mysql
make
make install
cd ../

生成应用程序:
#/usr/local/ruby/bin/rails /mnt/htdocs/xhb -d mysql

启动应用程序时,mysql驱动出错: uninitialized constant
MysqlCompat::MysqlRes
解决(http://www.tmtm.org/en/mysql/ruby/,http://dev.mysql.com/downloads/ruby.html):
gem uninstall mysql
wget
http://rubyforge.org/frs/download.php/44203/mysql-ruby-2.7.7.tar.gz
tar -zxvf mysql-ruby-2.7.7.tar.gz
cd mysql-ruby-2.7.7
ruby extconf.rb –with-mysql-dir=/usr/local/mysql
make
ruby ./test.rb — localhost dbusrname 123456 xhb_db
make install
cd /mnt/htdocs/xhb
mongrel_rails start -p 8000 -a 127.0.0.1

* passenger
* rake
* rails
* mysql
* bundler

Set listen(2) backlog
<value name=”backlog”>-1</value>

9、启动php-cgi进程,监听127.0.0.1的9000端口,进程数为128(如果服务器内存小于3GB,可以只开启64个进程),用户为www:
ulimit -SHn 65535
/usr/local/php/sbin/php-fpm start

name=”display_errors”>1</value>,以便显示PHP错误信息,否则,Nginx
会报状态为500的空白错误页):
<?xml version=”1.0″ ?>
<configuration>

安装完后会有类似这样的提示:
Installing shared extensions:    
/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/

*/

http://www.vpsee.com/2009/11/centos-install-redmine-git/

暂时这样配置:
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db
启动mysql:
/usr/local/mysql/share/mysql/mysql.server start
如果不能启动请运行/usr/local/mysql/bin/mysqld_safe –user=root
就能够启动了!!
接着输入/usr/local/mysql/share/mysql/mysql.server start即可成功启动
好了,我们把密码设置为123456 /usr/local/mysql/bin/mysqladmin -u root
password 123456

libmcrypt库
wget
http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure –enable-ltdl-install
make
make install
cd ../../

innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 512M
innodb_data_file_path = ibdata1:256M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0

安装memcache PHP模块
wget http://pecl.php.net/get/memcache-2.2.6.tgz
tar zxvf memcache-2.2.6.tgz
cd memcache-2.2.6/
/usr/local/php/bin/phpize
./configure –enable-memcache
–with-php-config=/usr/local/php/bin/php-config –with-zlib-dir
make
make install
cd ../

enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl
–with-curlwrappers –enable-mbregex –enable-fastcgi

Error log file
<value
name=”error_log”>/usr/local/php/logs/php-fpm.log</value>

7、创建www用户和组,以及供xhuoban.com和zhangwenyou.com两个虚拟主机使用的目录:
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
mkdir -p /mnt/htdocs/xhuoban
chmod +w /mnt/htdocs/xhuoban
chown -R www:www /mnt/htdocs/xhuoban
mkdir -p /mnt/htdocs/zhangwenyou
chmod +w /mnt/htdocs/zhangwenyou
chown -R www:www /mnt/htdocs/zhangwenyou

Make sure you don’t forget to paste the Apache configuration directives
that
the installer gives you.

安装eaccelerator:

安装libxml2
/*
wget
http://mirror.centos.org/centos-5/5/os/i386/CentOS/libxml2-2.6.26-2.1.2.8.i386.rpm
rpm -Uvh libxml2-2.6.26-2.1.12.el5_7.2.i386.rpm
*/
(http://download.chinaunix.net/download/0007000/6095.shtml)
wget http://down1.chinaunix.net/distfiles/libxml2-2.7.2.tar.gz
http://down1.chinaunix.net/distfiles/libxml2-2.6.27.tar.gz
tar zxvf libxml2-2.7.2.tar.gz
cd libxml2-2.7.2
./configure –prefix=/usr/local/libxml2
make
make install

<section name=”global_options”>

The log file for slow requests
<value name=”slowlog”>logs/slow.log</value>

soap
(configure参考:http://siyoung.iteye.com/blog/1052302)
make ZEND_EXTRA_LIBS=’-liconv’
make install
cp php.ini-dist /usr/local/php/etc/php.ini
cd ../

编译和安装 rubygems,安装 ruby mysql 支持:
先查看是否已经安装过rubygems了,/usr/local/ruby/bin/gem -v
如果已经自动安装上,就不要再装了。否则就要先安装gem
# tar zxvf rubygems-1.3.5.tgz
# cd rubygems-1.3.5

rpm -qa | grep zlib
如果没有装则
yum  install zlib zlib-devel

[mysqld]
character-set-server = utf8
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
user    = mysql
port    = 3306
socket  = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /mnt/mysql/3306/data
log-error = /mnt/mysql/3306/mysql_error.log
pid-file = /mnt/mysql/3306/mysql.pid
open_files_limit    = 10240
back_log = 600
max_connections = 5000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 300
#thread_concurrency = 8
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 3
log-slave-updates
log-bin = /mnt/mysql/3306/binlog/binlog
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 1G
relay-log-index = /mnt/mysql/3306/relaylog/relaylog
relay-log-info-file = /mnt/mysql/3306/relaylog/relaylog
relay-log = /mnt/mysql/3306/relaylog/relaylog
expire_logs_days = 30
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

Time limit on waiting child’s reaction on signals from master
<value name=”process_control_timeout”>5s</value>

make
make install
chmod +w /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
cd ../

mysql_port=3306
mysql_username=”admin”
mysql_password=”123456″

Redirect workers’ stdout and stderr into main error log.
If not set, they will be redirected to /dev/null, according to FastCGI
specs
<value name=”catch_workers_output”>yes</value>