• Red Hat Enterprise Linux 4 升级Mysql\Apache\PHP的独门秘笈

    by maxidea • 2009年05月13日 • UNIX\Linux • 0 Comments

    此秘笈均为本人的经验总结,已经在多台Red Hat Enterprise Linux 4上实战成功,特和大家一起分享:

    1)确认Red Hat Enterprise Linux 4内各旧软件包的版本
    以“rpm -q 软件包名” 得到如下:
    httpd-2.0.52-28.ent
    mysql-4.1.7-4.RHEL4.1
    php-4.3.9-3.1
    package libxml is not installed
    gd-2.0.28-4
    gd-2.0.28-4.4E.1
    perl-5.8.5-12

    2)下载以下软件包(下不到的人可以找我要):
    MySQL-server-standard-5.0.24-0.rhel4.x86_64.rpm
    MySQL-client-standard-5.0.24-0.rhel4.x86_64.rpm
    MySQL-devel-standard-5.0.24-0.rhel4.x86_64.rpm
    MySQL-shared-standard-5.0.24-0.rhel4.x86_64.rpm
    libxml2-2.6.23.tar.gz
    httpd-2.0.59.tar.gz
    gd-2.0.33.tar.gz
    php-5.1.4.tar.gz
    并放到服务器/tmp下面

    3)开始安装,基本按下面指令逐行输入即可:
    cd /tmp
    rpm -e mysql-4.1.7-4.RHEL4.1.i386 –nodeps
    rpm -e mysql-server
    rpm -e mysql-devel
    rpm -Uvh MySQL-server-standard-5.0.24-0.rhel4.x86_64.rpm –nodeps
    rpm -ivh MySQL-client-standard-5.0.24-0.rhel4.x86_64.rpm
    rpm -ivh MySQL-devel-standard-5.0.24-0.rhel4.x86_64.rpm
    rpm -ivh MySQL-shared-standard-5.0.24-0.rhel4.x86_64.rpm
    vi /etc/my.conf
    关闭#basedir=/var/lib
    mkdir /var/run/mysqld
    chown mysql.mysql /var/run/mysqld
    /sbin/service mysql start

    tar -zxvf libxml2-2.6.23.tar.gz
    cd libxml2-2.6.23
    ./configure
    make
    make tests
    make install

    tar -zxvf httpd-2.0.59.tar.gz
    cd httpd-2.0.59
    ./configure
    make
    make install
    vi /usr/local/apache2/conf/httpd.conf
    增加:
    AddType application/x-httpd-php .php
    DocumentRoot “/usr/local/apache2/htdocs”
    DirectoryIndex index.html index.html.var index.php

    vi /etc/rc.d/rc.local
    增加:
    /usr/local/apache2/bin/apachectl start
    (因为旧的Apache在安装Mysql 5后会无法使用)

    PHP需要重新编译:
    tar -zxvf gd-2.0.33.tar.gz
    cd gd-2.0.33
    ./configure
    make install

    cd /usr/lib64
    cp -p libpng12.a ../lib
    cp -p libpng.a ../lib
    cp -p libpng.so ../lib

    tar -zxvf php-5.1.4.tar.gz
    cd php-5.1.4
    ./configure –prefix=/usr/local/php5 –with-apxs2=/usr/local/apache2/bin/apxs –with-config-filepath=/usr/local/php5 –disable-debug –enable-ftp –enable-inline-optimization –enable-magic-quotes –enable-mbstring –enable-mm=shared –enable-safe-mode –enable-track-vars –enable-trans-sid –enable-wddx=shared –enable-xml –with-dom –with-gd –with-gettext –with-mysql=/usr/lib64/mysql –with-regex=system –with-xml –with-zlib –with-mysqli=/usr/bin/mysql_config
    make
    make install

    cp php.ini-dist /usr/local/php5/lib/php.ini

    vi /usr/local/php5/lib/php.ini
    include_path = “.:/usr/local/php5/lib/php”

    /etc/init.d/mysql restart
    /usr/local/apache2/bin/apachectl restart

    好了,到此就完成所有工作了。

    留下评论

    Your email address will not be published. Required fields are marked *