RedHat Linux 5.4中安装PHP+MySQL

farwang 2010-08-22

安装系统的版本:Red Hat Enterprise Linux Server release 5.4

内核版本:Linux version 2.6.18-164.el5 ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Tue Aug 18 15:51:54 EDT 2009

先检查一下要装的东东都在不在:

rpm -qa | grep -i apache

rpm -qa | grep -i httpd

rpm -qa | grep -i php

rpm -qa | grep -i mysql

没有,下一步我们安装。

首先把需要的安装包找到:

Apache:

下载地址:http://httpd.apache.org/download.cgi

下载文件:httpd-2.2.16.tar.gz

Mysql:

下载地址:http://www.mysql.com/downloads/mysql/#downloads

下载文件:MySQL-client-community-5.1.50-1.rhel5.i386.rpm

              MySQL-devel-community-5.1.50-1.rhel5.i386.rpm

              MySQL-server-community-5.1.50-1.rhel5.i386.rpm

              MySQL-shared-community-5.1.50-1.rhel5.i386.rpm

Php:

下载地址:http://php.net/downloads.php

下载文件:PHP 5.3.3.tar.gz

安装方法:

Apache:

tar -xvf httpd-2.2.16.tar.gz

cd httpd-2.2.16

安装apr,之前有就不用了

cd srclib/apr

./configure --prefix=/usr/local/apr-httpd/

make clean

make

make install

安装apr-util,之前有就不用了

cd ..

cd apr-util/

./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/

make clean

make

make install

安装httpd

cd ../..

./configure --prefix=/usr/local/apache2/ --enable-rule=SHATED_CORE --enable-module=so --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/

make clean

make

make install

启动:

/usr/local/apache2/bin/apachectl -k start

测试:

在浏览器中输入http://127.0.0.1 页面显示It works!

停止:

/usr/local/apache2/bin/apachectl -k stop

详细信息参见:http://httpd.apache.org/docs/2.2/


安装Mysq

rpm -ivh MySQL-server-community-5.1.50-1.rhel5.i386.rpm

rpm -ivh MySQL-client-community-5.1.50-1.rhel5.i386.rpm

rpm -ivh MySQL-devel-community-5.1.50-1.rhel5.i386.rpm

rpm -ivh MySQL-shared-community-5.1.50-1.rhel5.i386.rpm

/usr/bin/mysqladmin -u root password '****'

mysql -u root –p

相关推荐