会动的耳朵  

参考:http://www.ansen.org/centos-build-lnmp.html

1 CentOS iptables 配置

ifcfg-eth0配置

selinux配置

2 资源列表 :

mysql5.5.28: http://sourceforge.net/projects/mysql.mirror/files/MySQL%205.5.28/

http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.28-linux2.6-x86_64.tar.gz

php5.4: http://www.php.net/get/php-5.4.13.tar.gz/from/a/mirror

      http://cn2.php.net/get/php-5.4.8.tar.gz/from/a/mirror

nginx: http://nginx.org/download/nginx-1.3.15.tar.gz

http://nginx.org/download/nginx-1.3.8.tar.gz

jpeg src : http://www.ijg.org/

 

下载pcre (支持nginx伪静态)
http://exim.mirror.fr/pcre/  http://sourceforge.net/projects/pcre/files/pcre/

CMAKE: http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz

libmcrypt: ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz

3 安装依赖库:

yum installmakeapr* autoconf automake curl curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch libevent-devel php-devel【支持phpize】

 

4   安装CMAKE (不一定需要) ,libmcrypt,FreeType(安装gd时候需要) ,PCRE 

http://sourceforge.net/projects/freetype/files/freetype2/2.4.11/freetype-2.4.11.tar.gz/download

tar zxvf freetype-2.4.11*

./configure 

./configure --prefix=/usr/local/freetype

make && make install

  

5 安装libjpeg 

  不清楚为啥第三部没有装上libjpeg的支持,不得不重新编译php

http://www.ijg.org/files/jpegsrc.v9.tar.gz

tar zxvf jpegsrc.v9.*

cd jpegv9

./configure --prefix=/usr/local/jpeg9/ --enable-shared --enable-static

make && make install

  安装 libpng

 http://sourceforge.net/projects/libpng/files/libpng12/1.2.50/libpng-1.2.50.tar.gz/download

6 安装gd2

https://bitbucket.org/libgd/gd-libgd/downloads

https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.0-rc1.tar.gz

tar zxvf gd-2.1.0-preview.tar.gz

./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg9/ --with-png=/usr/local/libpng/ --with-zlib --with-freetype=/usr/local/freetype/

make && make install

 

 

7 安装mysql 5.5.28

直接从官网下载已编译好的,不知道为啥其他版本编译不过去

shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysqld

加上这个命令:chkconfig mysqld on[随系统启动]

service mysqld start ,这个时候pid文件在data目录了

8 安装nginx


tar zxvf nginx-1.3.8.*

cd nginx-1.3.8

groupadd www #添加www组

useradd -g www www -s /bin/false #创建nginx运行账户www并加入到www组,不允许www用户直接登录系统cd /usr/local/src
tar zxvf nginx-1.0.12.tar.gz
cd nginx-1.0.12
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/usr/local/src/pcre-8.30
注意:--with-pcre=/usr/local/src/pcre-8.30指向的是源码包解压的路径,而不是安装的路径,否则会报错
make
make install
/usr/local/nginx/sbin/nginx #启动nginx

 

9 安装PHP5 

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mysqlnd  --with-pdo-mysql --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-magic-quotes --enable-safe-mode --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --with-bz2 --enable-soap --with-pear --with-gettext --enable-session --with-mcrypt --with-curl  --with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg9 --with-png-dir=/usr/local/libpng/ --with-libxml-dir=/usr/include/libxml2/ --enable-exif --enable-bcmath  --enable-shmop --enable-sysvsem --enable-sysvmsg --enable-sysvshm --with-mhash --with-openssl --disable-json

 【删除线下的参数,5.5.6不支持】

这里禁用了json因为要使用jsond,我自己修改了jsond的源码,兼容json的函数和常量

  --with-iconv-dir --with-freetype-dir --with-png-dir --with-libxml-dir --with-mysql=mysqlnd

  --with-gd=shared 

 

make && make install 

 

 10 配置nginx server

nginx最常用的方法是利用 tcp/ip 协议连接 phpfastcgi 接口, 因此要连接php必须先启动fastcgi程序.

启动方法:

/usr/local/php5/bin/php-cgi -b 9000 -c /etc/php.ini &

-b 用于指定监听地址与端口(nginx.conf默认是9000)

如果想指定配置文件位置,可以使用-c选项

 

访问php文件报出:“No input file specified.” 解决方法如下:

参考:http://zhidao.baidu.com/question/325668800.html

#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

改为$document_root即可

---不知道为啥,amqp没有编译完成,就又报同样的问题了

于是

改成这样:fastcgi_param  SCRIPT_FILENAME  /data1/www/test$fastcgi_script_name;

 

posted on 2013-04-02 10:05  会动的耳朵  阅读(555)  评论(17编辑  收藏  举报