当前位置: 首页 >> 应用软件 >> 网络相关 >> 编译安装apache2+php5+mysql4+ZendOptimizer+Cronolog简易文档
 

编译安装apache2+php5+mysql4+ZendOptimizer+Cronolog简易文档

作者:longrujun      来源:csdn blog     发表时间:2006-04-22     浏览次数:      字号:    

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/appsapache2mysqlphpmhashimageMagickcronolog等应用环境

        /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

 

 

 

3Configure 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路径:

    /Data/apps/php/bin/phpize

    cd ../..

rm -Rf ./configure

./buildconf --force


$ vi config.sh
写入内容:

代码:


#!/bin/bash

PHP_ROOT=/Data/apps/php/

./configure --prefix=$PHP_ROOT \

            --with-apxs2=/Data/apps/apache2/bin/apxs \

            --with-mysql=/Data/apps/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 /Data/apps/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.
启用MPMVirtual hosts

# Server-pool management (MPM specific)

Include conf/extra/httpd-mpm.conf

# Virtual hosts

Include conf/extra/httpd-vhosts.conf

 

E.修改MPMVirtual 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

编辑 webmaster

 
 
 
评论更多>>
 
 
发表
 
姓名: QQ:
性别: MSN:
E-mail: 主页:
评分: 1 2 3 4 5
评论内容:
验证码:
  
  • 请遵守《互联网电子公告服务管理规定》及中华人民共和国其他各项有关法律法规。
  • 严禁发表危害国家安全、损害国家利益、破坏民族团结、破坏国家宗教政策、破坏社会稳定、侮辱、诽谤、教唆、淫秽等内容的评论 。
  • 用户需对自己在使用本站服务过程中的行为承担法律责任(直接或间接导致的)。
  • 本站管理员有权保留或删除评论内容。
  • 评论内容只代表网友个人观点,与本网站立场无关。
  •