全新最新LNMP,Centos 5.* ,php-5.3.8,MYSQL5.5.17,nginx-1.0.9

弄完好久忘记发了!
一些配置文件

php.ini php-fpm.conf [下载 php.conf.tar]
弄完好久忘记发了! 一些配置文件 php.ini php-fpm.conf [下载 php.conf.tar]

cp  /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel  ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel libtool  libtool-libs libevent-devel libevent openldap openldap-devel nss_ldap openldap-clients openldap-servers libtool-ltdl libtool-ltdl-devel bison libjpeg*

下载所需包:

wget http://au.php.net/distributions/php-5.3.8.tar.gz 
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz 
wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz 
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz 
wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz 
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz 
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/http://mysql.mirrors.pair.com/ 
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.tar.gz 
wget  http://pecl.php.net/get/memcache-2.2.6.tgz 
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz 
wget http://cdnetworks-kr-1.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip 
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz 
wget ftp://mirror.aarnet.edu.au/pub/imagemagick/ImageMagick-6.6.8-10.tar.gz 
 ftp://ftp.u-aizu.ac.jp/pub/graphics/image/ImageMagick/imagemagick.org/ImageMagick-6.6.9-10.tar.gz 
wget ftp://gd.tuwien.ac.at/pub/graphics/ImageMagick/ImageMagick-6.7.3-3.tar.gz 
wget http://pecl.php.net/get/imagick-3.0.1.tgz 
wget http://nginx.org/download/nginx-1.0.9.tar.gz 

解压:

for i in ls ./* ;do tar -zxvf $i -C /usr/local/src/ ;done 
unzip eaccelerator-0.9.6.1.zip -d /usr/local/src
cd /usr/local/src/libiconv-1.14 
./configure --prefix=/usr/local 
make  && make install 
ldconfig
cd ../libmcrypt-2.5.8/ 
./configure 
make &&  make install 
ldconfig 
cd  libltdl/ 
./configure --enable-ltdl-install 
make 
make install 
cd ../../ 
cd mhash-0.9.9.9/ 
./configure 
make 
make  install 
ldconfig
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 
ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la 
ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so 
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 
ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a 
ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la 
ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so 
ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2 
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
ldconfig
cd  mcrypt-2.6.8/ 
./configure

                    cfgfile="${ofile}T" 
trap "$RM  \"$cfgfile\"; exit 1" 1 2 15 
修改大概这个位置的  $RM -f  "$cfgfile"

make 
make install 
ldconfig
cd ../cmake-2.8.6/ 
./configure --prefix=/usr && make && make install
cd ../mysql-5.5.17/ 
groupadd  mysql 
useradd -g mysql mysql 
mkdir -p /opt/webserver/mysql 
mkdir -p  /data0/mysql

cmake . -DCMAKE_INSTALL_PREFIX=/opt/webserver/mysql/  -DMYSQL_DATADIR=/data0/mysql/data  -DMYSQL_UNIX_ADDR=/data0/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1  -DENABLED_LOCAL_INFILE=1  -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all  -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk  -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci  -DWITH_DEBUG=0 -DWITH_READLINE=1 -DWITH_SSL=system  -DWITH_ZLIB=system  -DSYSCONFDIR=/data0/mysql

make 
make install 
cd .. 
chmod +w /opt/webserver/mysql/ 
chown -R mysql.mysql /opt/webserver/mysql/ 
chown -R mysql.mysql /data0/mysql/ 
/opt/webserver/mysql/scripts/mysql_install_db --basedir=/opt/webserver/mysql --datadir=/data0/mysql/data --user=mysql

/opt/webserver/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/my.cnf

ln -s /opt//webserver/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18 
ln -s /opt//webserver/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

ldconfig


cd ../php-5.3.8/ 
mkdir -p /opt/webserver/php/etc/

./configure --prefix=/opt/webserver/php --with-config-file-path=/opt/webserver/php/etc --with-mysql=/opt/webserver/mysql --with-mysqli=/opt/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath   --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex   --enable-fpm  --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap

###################################################
如果出现:
configure: error: Cannot find ldap libraries in /usr/lib.
解决办法:

cp -frp /usr/lib64/libldap* /usr/lib/

configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
–enable-re2c-cgoto Enable -g flag to re2c to use computed goto gcc extension

configure: warning: lemon versions supported for regeneration of libsqlite parsers: 1.0 (found: none).

yum install sqlite-devel 

####################################################

make ZEND_EXTRA_LIBS='-liconv' 
make install

#########################
问题:
PEAR package PHP_Archive not installed: generated phar will require PHP’s phar extension be enabled.
解决方法:当前php目录
下载:wget http://pear.php.net/go-pear.phar
执行:/opt/webserver/php/bin/php go-pear.phar
可以选择all,或其他

cp  php.ini-production /opt/webserver/php/etc/php.ini 

#########################

cd  ../memcache-2.2.6/ 
/opt/webserver/php/bin/phpize 
./configure --with-php-config=/opt/webserver/php/bin/php-config 
make  &&  make install 
ldconfig
cd ../eaccelerator-0.9.6.1/ 
/opt/webserver/php/bin/phpize 
./configure --enable-eaccelerator=shared --with-php-config=/opt/webserver/php/bin/php-config 
make  &&  make install 
ldconfig
cd  ../PDO_MYSQL-1.0.2/ 
/opt/webserver/php/bin/phpize 
./configure --with-php-config=/opt/webserver/php/bin/php-config --with-pdo-mysql=/opt/webserver/mysql 
make && make  install 
ldconfig
cd ../ImageMagick-6.6.9-10 
./configure 
make  && make install 
ldconfig
cd ../imagick-3.0.1/ 
/opt/webserver/php/bin/phpize 
./configure --with-php-config=/opt/webserver/php/bin/php-config 
make  && make install 
ldconfig
groupadd www 
useradd -g www www
cd pcre-8.13/ 
./configure  &&  make  && make install 
ldconfig
cd ../nginx-1.0.9/ 
./configure --user=www --group=www --prefix=/opt/webserver/nginx --with-http_stub_status_module --with-http_ssl_module 
make   && make  install
echo "ulimit -SHn 65535" >>  /etc/rc.local 
source /etc/rc.local 
mkdir /data0/nginx/logs/ 
chmod  +w /data0/nginx/logs/
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

报错的话可能是我没执行完,可以参考《Web服务LNMP环境源码搭建,基于最新包》
未做操作

/opt/webserver/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/my.cnf 
/opt/webserver/php/sbin/php-fpm 
/opt/webserver/nginx/sbin/nginx

- THE END -
版权声明:
转载原创文章请注明,文章出处:http://kinggoo.com
原文地址:http://kinggoo.com/applnmpnew109.htm
发表评论?

6 条评论。

  1. 哎,哎,哎。。伤不起啊

  2. WOW! This can be intense! Cheers! 🙂

  3. agriturismo toscana pisa - trackback on 2011 年 12 月 30 日 在 18:52

发表评论


Trackbacks and Pingbacks: