源码搭建LAMP平台
一.环境:
           RED HAT ENTERPRISE LINUX 5
二.所需软件包:
     MySQL-5.1.30.tar.gz
     httpd-2.2.11.tar.bz2
     libmcrypt-2.5.8.tar.bz2
     re2c-0.13.5.tar.gz
     php-5php-5.2.8.tar.bz2ZendOptimizer
三.移除已经存在的服务与解决依赖性
 3.1 执行如下命令移除已经存在的服务:
      rpm -e `rpm -qa|grep php` --nodeps
      rpm -e `rpm -qa|grep mysql` --nodeps
      rpm -e `rpm -qa|grep httpd` --nodeps
 3.2 使用yum解决依赖性:
    本次实验所需要解决的:(前提是你的yum仓库已经搭建好)
      yum install openldap-devel gcc gcc-c++ openssl openssl-devel libtool libtool-ltdl libtool-ltdl-devel bison bison-devel bison-runtime flex libtermcap-devel libxml2-devel gmp-devel gd-devel zlib-devel curl-devel net-snmp-devel libpng-devel libjpeg-devel freetype-devel
四:开始安装服务:
 4.1安装MYSQL
      1.添加mysql用户        useradd  mysql
      2.解压包并安装:
       tar -zxf  MySQL-5.1.30.tar.gz
       cd MySQL-5.1.30
       CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti"
       ./configure --prefix=/usr/local/mysql \
       --with-charset=gb2312 \
       --with-extra-charsets=none \
       --enable-assembler \
       --enable-thread-safe-client \
       --with-client-ldflags=-all-static \
       --with-mysqld-ldflags=-all-static \
       --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
       --disable-shared
        make   &&   make install
        cp support-files/my-medium.cnf /etc/my.cnf
        NOTE: Modify /etc/my.cnf comment "skip-federated"
        cp support-files/mysql.server /etc/init.d/mysqld
        chmod 755 /etc/init.d/mysqld
        chkconfig mysqld on
        chown -R mysql.mysql  /usr/local/mysql/*
        /usr/local/mysql/bin/mysql_install_db --user=mysql
        chown -R root  /usr/local/mysql/*
        chown -R mysql  /usr/local/mysql/var
        ln -s  /usr/local/mysql/bin/$file    /usr/bin/$file
        /etc/init.d/mysqld start
        NOTE: If mysql into a production environment, then run  "/usr/local/mysql/bin/mysql_secure_installation"
 4.2 安装apache
         tar jxf  httpd-2.2.11.tar.bz2
         cd httpd-2.2.11//srclib/apr
         ./configure --prefix=/usr/local/apr
          make    &&  make test   && make install
          cd ../apr-util
          ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
          make      &&  make test     && make install
          cd ../..
          ./configure --prefix=/usr/local/apache \
          --enable-mods-shared=all \
          --enable-so \
          --with-mpm=worker \
          --with-apr=/usr/local/apr \
          --with-apr-util=/usr/local/apr-util
          make  &&   make install
          /usr/local/apache/bin/apachectl start
          ln -s  /usr/local/apache/bin/apachectl    /usr/bin
4.3 安装libmcrypt
          tar jxf libmcrypt-2.5.8.tar.bz2
          cd libmcrypt-2.5.8
          ./configure
           make      &&   make install
4.4  安装re2c
           tar zxf re2c-0.13.5.tar.gz
           cd re2c-0.13.5
           ./configure
           make     && make install
4.5 安装PHP
           tar jxf php-5.2.8.tar.bz2
           cd php-5.2.8
           ./configure --prefix=/usr/local/php \
           --with-apxs2=/usr/local/apache/bin/apxs \
           --with-mysql=/usr/local/mysql \
           --with-openssl \
           --with-ldap \
           --with-snmp \
           --with-gd \
           --with-zlib \
           --with-curl \
           --with-libxml-dir \
           --with-png-dir \
           --with-jpeg-dir \
           --with-freetype-dir \
           --with-pear \
           --with-gettext \
           --with-gmp \
           --with-mcrypt \
           --without-sqlite \
           --disable-debug \
           --enable-inline-optimization \
           --enable-soap \
           --enable-ftp \
           --enable-sockets \
           --enable-mbstring
           make      &&    make install
           cp php.ini-recommended   /usr/local/php/etc/php.ini
           cd ..
           echo "AddType application/x-httpd-php .php .phtml" >> /usr/local/apache/conf/httpd.conf
           echo "<? phpinfo() ?>"  >  /usr/local/apache/htdocs/index.php
   注:vi /usr/local/apache/conf/httpd.conf
           <IfModule dir_module>
              (使 apache 支持 php 作为默认首页)
             DirectoryIndex index.html index.php
           </IfModule>
4.6 安装ZendOptimizer
              tar jxf  ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
              cd  ZendOptimizer-3.3.3-linux-glibc23-i386
               ./install
                                      GOOD LUCK!