编译安装apache2+php5+mysql4+ZendOptimizer+Cronolog简易文档
编译安装apache2+php5+mysql4+ZendOptimizer+Cronolog简易文档 编译安装apache2+php5+mysql4+ZendOptimizer+Cronolog简易文档
Setp_1
安装包下载:
apache2
http://mirror.vmmatrix.net/apache/httpd/httpd-2.2.0.tar.gz
mysql4:
http://mysql.oss.eznetsols.org/Downloads/MySQL-4.1/mysql-4.1.15.tar.gz
php5:
http://cn.php.net/get/php-5.1.2.tar.bz2/from/this/mirror
apr 1.2
http://www.apache.org/dist/apr/apr-1.2.6.tar.gz
apr-util 1.2
http://www.apache.org/dist/apr/apr-util-1.2.6.tar.gz
mhash
http://internap.dl.sourceforge.net/sourceforge/mhash/mhash-0.9.6.tar.gz
cronolog
http://cronolog.org/download/cronolog-1.6.2.tar.gz
ImageMagick-6.2.6-2.tar.bz2
http://www.imagemagick.org/script/download.php
Magickwand
http://www.magickwand.org/download/php/magickwand-0.1.8.tar.gz
ZendOptimizer-2.6.2-linux-glibc21-i386.tar.gz
http://www.zend.com/products/zend_optimizer
Setp_2
+++++++++++++
webapps 应用体系安装结构
/Data/apps:apache2、mysql、php、mhash、imageMagick、cronolog等应用环境
/logs:记录apache2,mysql等日志
/webapps :webcode
+++++++++++++
mysql 安装:
$ tar zxvf mysql-4.1.15.tar.gz
$ cd mysql-4.1.15
# groupadd mysql
# useradd -g mysql mysql
# ./configure --prefix=/Data/apps/mysql # make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
# cd /Data/appsl/mysql
# bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &
apache 2 安装:
1、# Build and install apr 1.2
# tar zxvf apr-1.2.6.tar.gz
# cd apr-1.2.6
#./configure --prefix=/Data/apps/apr-httpd/
#make
#make install
2、# Build and install apr-util 1.2
# tar zxvf apr-util-1.2.6.tar.gz
# cd apr-util-1.2.6
# ./configure --prefix=/Data/apps/apr-util-httpd > --with-apr=/Data/apps/apr-httpd
#make
#make install
3、# Configure httpd
# tar jxvf httpd-2.2.0.tar.bz2
# cd httpd-2.2.0
# vi config.sh 写入内容如下:
代码:
#!/bin/bash
HTTPD_ROOT='/Data/apps/apache2'
./configure --prefix=$HTTPD_ROOT --with-apr=/Data/apps/apr-httpd --with-apr-util=/Data/apps/apr-util-httpd --enable-so --enable-rewrite --enable-info --enable-cgid --enable-mime-magic --enable-vhost-alias --enable-deflate --enable-expires --with-mpm=prefork
# sh config.sh
上面过程等同于直接
./configure --prefix=$HTTPD_ROOT --with-apr=/Data/apps/apr-httpd --with-apr-util=/Data/apps/apr-util-httpd --enable-so --enable-rewrite --enable-info --enable-cgid --enable-mime-magic --enable-vhost-alias --enable-deflate --enable-expires --with-mpm=prefork
# make
# make install
安装php5
1、# Build and install mhash
#tar zxvf mhash-0.9.6.tar.gz
#cd mhash-0.9.6
# ./configure --prefix=/Data/apps/mhash
#make
#make install
# cd include/mutils/
# cp * /Data/apps/mhash/include/mutils/
2、# Build and install ImageMagick-6.2.6-2.
#tar zxvf ImageMagick-6.2.6-2.tar.gz
# cd ImageMagick-6.2.6
#./configure –prefix=/Data/apps/ImageMagick
#make
#make install
#ln -sf /Data/apps/ImageMagick/lib/libWand.so.10.0.2 /usr/lib/libWand.so
#ln -sf /Data/apps/ImageMagick/lib/libWand.so.10.0.2 /usr/lib/libWand.so.10
#ln -sf /Data/apps/ImageMagick/lib/libMagick.so.10.0.2 /usr/lib/libMagick.so
#ln -sf /Data/apps/ImageMagick/lib/libMagick.so.10.0.2 /usr/lib/libMagick.so.10
3、Configure php& magickwand
#tar jxvf php-5.1.2.tar.bz2
#cd php-5.1.2/ext/
# tar zxvf magickwand-0.1.8.tar.gz
在phpsrc\ext\magickwand 目录下运行 phpize
或填写完整phpize路径:
/usr/local/apps/php/bin/phpize
cd ../..
rm -Rf ./configure
./buildconf --force
$ tar jxvf php-4.4.1.tar.bz2
$ cd php-4.4.1
$ vi config.sh 写入内容:
代码:
#!/bin/bash
PHP_ROOT=/usr/local/php/
./configure --prefix=$PHP_ROOT --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-mbstring --with-curl --disable-debug --enable-inline-optimization -q --with-jpeg-dir=/usr/local/ --with-png-dir --enable-thread-safety --enable-ctype --with-bz2 --with-zlib --with-gd --with-kerberos --with-gettext --enable-force-cgi-redirect --with-iconv --enable-gd-native-ttf --enable-sockets --with-snmp --enable-ucd-snmp-hack
$sh config.sh
$ make
# make install
#cp php.ini-dist /usr/local/php/lib/php.ini
Step_3 配置:
1.MYSQL[/etc/my.cnf]
去掉[mysqld]段skip-networking这句的注释,这样mysql只能从本机连接,有助提高安全性。
有关mysql的安全配置,请参考http://blog.donews.com/longrujun/archive/2005/11/30/643235.aspx
2.apache[/apache/conf/httpd.conf ]
修改
A. ServerAdmin u@irunnet.com
B. ServerName www.irunnet.com:80
C. <Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
D. <IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
E. AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
F. 启用MPM、Virtual hosts
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
E.修改MPM、Virtual Hosts
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 4000
MaxClients 2000
MaxRequestsPerChild 0
</IfModule>
<VirtualHost *:80>
ServerAdmin webmaster@irunnet.com
DocumentRoot /Data/webapps
ServerName irunnet.com
ErrorLog logs/irunnet.com-error_log
CustomLog logs/irunnet.com-access_log common
</VirtualHost>
测试:
在/apache2/htdocs 创建文件phpinfo.php 内容为:
代码:
<?php
echo phpinfo();
?>
Step_4
# Build and install ZendOptimizer
#tar zxvf ZendOptimizer-2.6.2-linux-glibc21-i386.tar.gz
# ./install.sh
# Build and install cronolog
#tar zxvf cronolog-1.6.2.tar.gz
#./configure --prefix=/Data/apps/cronolog
#make
#make install
配置virtual host日志配置
ErrorLog '|/Data/apps/cronolog/sbin/cronolog -S /Data/logs/www.irunnet.com-error_log /Data/logs/%Y/%m/www.irunnet.com-error_log.%m%d'
CustomLog '|/Data/apps/cronolog/sbin/cronolog -S /Data/logs/www.irunnet.com-access_log /Data/logs/%Y/%m/www.irunnet.com-access_log.%m%d%H' combined
Step_5 建立启动脚本
1、 echo “cd /Data/apps/apache2/bin/;./apachectl start” >>/etc/rc.local
2、 echo “cd /Data/apps/mysql/bin/;./mysqld_safe –user=mysql & ” >>/etc/rc.local
在浏览器中打开 http://127.0.0.1/phpinfo.php 如果你能看到 phpinfo 界面那么ok。