php爱好者
RSS 图标 Email 图标 首页图标
  • LINUX64位 APACHE2.2 Mysql5.1 php5.29安装

    发表于 2009年05月19日 admin 没有评论

    首先下载必备的软件,您可以直接粘贴复制!
    #mysql
    wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.1/mysql-5.1.34.tar.gz
    #php
    wget http://cn2.php.net/get/php-5.2.9.tar.gz/from/this/mirror

    #apache
    wget http://labs.xiaonei.com/apache-mirror/httpd/httpd-2.2.11.tar.gz

    #openssl
    wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz

    #gd库,php程序需要最新gd库及相关文件
    wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
    wget http://nchc.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.36.tar.gz
    wget http://nchc.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.9.tar.gz
    wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz

    #Libtool 注意,linux64位操作系统安装jpg时候需要升级libtool
    wget http://ftp.gnu.org/gnu/libtool/libtool-2.2.6a.tar.gz

    #curl,如果php开通curl功能需要下载
    wget http://curl.haxx.se/download/curl-7.19.4.tar.gz

    #libxml 如果php开通libxml功能需要下载
    wget http://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.30.tar.gz

    #libxslt 如果php开通libxslt功能需要下载
    wget http://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/libxslt-1.1.22.tar.gz

     

    第一步:安装mysql5.1
    groupadd mysql
    useradd -g mysql mysql
    tar -zxvf mysql-5.1.34.tar.gz
    cd mysql-5.1.34

    #记住,全部是小写
    ./configure –prefix=/data1/mysql –enable-thread-safe-client –with-extra-charsets=gbk –with-plugins=all
    make;
    make install;

    /data1/mysql/bin/mysql_install_db

    # chown -R root /data1/mysql
    # chgrp -R mysql /data1/mysql
    # chown -R mysql /data1/mysql/var

    #cp /data1/mysql/share/mysql/my-medium.cnf /etc/my.cnf 如果您执行了这句话,那么注意把 /etc/my.cnf 中的skip-federated注销!

    #启动mysql

    /data1/mysql/bin/mysqld_safe &
    #登录
    /data1/mysql/bin/mysql -uroot -p
    #祝贺您,安装成功!
    //关闭mysql
    /data1/mysql/bin/mysqladmin -uroot -p shutdown

    #回到软件目录
    cd ..

     

     第二步,安装apache

    #安装openssl
    tar zxvf openssl-0.9.8k.tar.gz
    cd openssl-0.9.8
    ./config –prefix=/usr/local/openssl
    make
    make install
    cd..

    apache2.2
    tar zxvf  gd-2.0.33.tar.gz
    cd httpd-2.2.11

    ./configure –prefix=/data1/apache –enable-modules=so –enable-rewrite –with-ssl=/usr/local/openssl
    make
    make install;
    /data1/apache/bin/apachectl start

    #马上测试一下吧,在浏览器里敲http://www.netdot.cn/。注:把www.netdot.cn换成您的域名或者ip
    #关闭apache
    #也可以选择增加压缩模块 /data1/apache/bin/apxs -i -c modules/filters/mod_deflate.c
    #需要在conf文件中增加:#LoadModule deflate_module modules/mod_deflate.so
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml

    /data1/apache/bin/apachectl stop
    #回到软件目录
    cd ..

    第三步 安装php

    libtooles 升级

    //卸掉原来的
    rpm -qa|grep libtool
    rpm -e libtool-1.5.22-6.1

    tar zxvf libtool-2.2.6a.tar.gz
    cd libtool-2.2.6

    ./configure –prefix=/usr/local/libtool
    make
    makestall
    cd ..

    #安装jpeg6
    jpeg6
    mkdir -p /usr/local/jpeg6
    mkdir -p /usr/local/jpeg6/bin
    mkdir -p /usr/local/jpeg6/lib
    mkdir -p /usr/local/jpeg6/include
    mkdir -p /usr/local/jpeg6/man
    mkdir -p /usr/local/jpeg6/man1
    mkdir -p /usr/local/jpeg6/man/man1

    tar zxvf jpegsrc.v6b.tar.gz
    cp /usr/local/libtool/share/libtool/config/config.sub      jpeg-6b/
    cp /usr/local/libtool/share/libtool/config/config.guess    jpeg-6b/

    cd jpeg-6b/
    ./configure –prefix=/usr/local/jpeg6/ –enable-shared –enable-static
    make
    make install
    cd ..

     

    #安装freetype
    tar zxvf freetype-2.3.9.tar.gz
    cd freetype-2.3.9
    ./configure –prefix=/usr/local/freetype
    make
    make install
    cd ..
    #安装libpng
    tar -zxvf libpng-1.2.36.tar.gz
    cd libpng-1.2.36
    ./configure –prefix=/usr/local/libpng
    make; make install
    cd ..
    #gd库
    tar -zxf gd-2.0.33.tar.gz
    cd gd-2.0.33
    ./configure –prefix=/usr/local/gd2 –with-jpeg=/usr/local/jpeg6 –with-png-dir=/usr/local/libpng  –with-freetype=/usr/local/freetype
    make; make install
    cd ..

    #curl
    tar -zxvf curl-7.19.4.tar.gz
    cd curl-7.19.4
    ./configure –prefix=/usr/local/curl
    make; make install

    #libxml2
    tar -zxf libxml2-2.6.30.tar.gz
    cd libxml2-2.6.30
    ./configure –prefix=/usr/local/libxml2
    make
    make install
    cd ..
    #libxslt
    tar zxvf libxslt-1.1.22.tar.gz
    cd libxslt-1.1.22
    ./configure –prefix=/usr/local/libxslt –with-libxml-prefix=/usr/local/libxml2
    make
    make install
    cd ..
    #关键时刻到了,安装php.注意,由于配置命令过长,加了”\”换行符
    tar zxvf php-5.2.9.tar.gz
    cd  php-5.2.9
    #当然,如果您怕出错,可以少加一些组件,等熟悉了在重新编译php。如:./configure –prefix=/usr/local/php –with-apxs2=/data1/apache/bin/apxs –with-mysql=/data1/mysql/
    ./configure –prefix=/usr/local/php  \
    –with-apxs2=/data1/apache/bin/apxs \
    –with-mysql=/data1/mysql \
    –with-curl=/usr/local/curl –enable-ftp \
    –with-libxml-dir=/usr/local/libxml2 \
    –enable-soap \
    –with-xsl=/usr/local/libxslt \
    –with-gd=/usr/local/gd2 \
    –with-jpeg-dir=/usr/local/jpeg6 \
    –with-png-dir=/usr/local/libpng \
    –with-zlib \
    –with-freetype-dir=/usr/local/freetype

    make
    make install

    cp php.ini-dist /usr/local/php/php.ini 
    第四步:重新配置apache2,能支持php
    vim /data1/apache/conf/httpd.conf
    在LoadModule php5_module modules/libphp5.so
    添加AddType application/x-httpd-php  .php
    /data1/apache/bin/apachectl start
    第六部 恭喜您,安装结束
    弄一个phpinfo.php放到/data1/apache/htdocs目录下,试验一下吧.

    发表评论