这是我在红旗5.0上的apache+php+mysql+phpMyAdmin安装过程。运行良好,目前未发现问题。
需要以下四个压缩文件:
mysql-standard-4.1.12-pc-linux-gnu-i686.tar.gz (下载地址http://dev.mysql.com/downloads/mysql/4.1.html)
MySQL-client-4.1.14-0.i386.rpm (mysql客户端) (下载地址http://dev.mysql.com/downloads/mysql/4.1.html)
httpd-2.0.54.tar.gz (下载地址http://httpd.apache.org/download.cgi)
php-4.4.0.tar.gz (下载地址http://www.php.net/downloads.php#v4)
phpMyAdmin-2.5.7-pl1.tar.gz (下载地址http://www.phpmyadmin.net/home_page/downloads.php)
将压缩文件都放在/root,
将mysql-standard-4.1.12-pc-linux-gnu-i686.tar.gz解压,为方便,将文件夹重命名为mysql。移动到/usr/local/(也可以在/usr/local建立个链接到/root/mysql)
[root@shunzi ~]#mv mysql /usr/local/mysql
这是二进制的,不需要编译,只需做一些相应的配置就可以使用了。
[root@shunzi ~]# groupadd mysql
[root@shunzi ~]# useradd -g mysql mysql
[root@shunzi ~]# cd /usr/local/mysql
[root@shunzi mysql]# scripts/mysql_install_db --user=mysql
[root@shunzi mysql]# chown -R root .
[root@shunzi mysql]# chown -R mysql data
[root@shunzi mysql]# chgrp -R mysql .
[root@shunzi mysql]# bin/mysqld_safe --user=mysql &
看到:
[1] 5134
[root@shunzi mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/shunzi.pid
030102 21:00:46 mysqld ended
提示启动失败了,这是由于权限的问题,执行下列命令:
chown -R root /usr/local/mysql
chgrp -R mysql /usr/local/mysql
执行:
[root@shunzi mysql]# bin/mysqld_safe --user=root &
可以看到类似的内容:
[1] 5846
5846 pts/1 S 0:00 /bin/sh bin/mysqld_safe --user=root
5864 pts/1 S 0:00
/usr/local/mysql/bin/mysqld
--defaults-extra-file=/usr/local/mysql/data/my.cnf --ba
这说明mysql服务已经启动了。mysql服务器安装成功了。如还不行,就再检查mysql文件的权限。
接着安装客户端MySQL-client-4.1.14-0.i386.rpm,这个也直接双击安装。执行:
[root@shunzi mysql]# mysql
ERROR 2002 (HY000): Can''t connect to local MySQL server through socket ''/var/lib/mysql/mysql.sock'' (2)
提示找不到接口文件,借口文件在/tmp/mysql.sock,可建立一个软链接:
[root@shunzi mysql]# mkdir /var/lib/mysql
[root@shunzi mysql]# cd /var/lib/mysql
[root@shunzi mysql]# ln -s /tmp/mysql.sock mysql.sock
执行:
[root@shunzi mysql]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 11 to server version: 4.1.12-standard
Type ''help;'' or ''h'' for help. Type ''c'' to clear the buffer.
mysql>
说明客户端可以与mysql服务器连接上了;为了安全,接着给root 用户设置密码:
mysql> quit
Bye
[root@shunzi mysql]# cd /usr/local/mysql/bin
[root@shunzi bin]# mysqladmin -u root -h localhost password ******(换成你的密码)
***********************************************************************************
安装apache:
[root@shunzi ~]# tar xzvf httpd-2.0.54.tar.gz
[root@shunzi ~]# cd httpd-2.0.54
详细的配置可以用 ./configure --help 来查看,下面只是我的配置。
[root@shunzi httpd-2.0.54]#./configure --prefix=/usr/local/apache
--enable-shared=max --enable-module=rewrite --enable-module=most
[root@shunzi httpd-2.0.54]# make
[root@shunzi httpd-2.0.54]# make install
启动apache服务:
[root@shunzi httpd-2.0.54]# /usr/local/apache/bin/apachectl start
在浏览器里输入http://localhost,如果能看到欢迎页面,那么apache就安装成功了。
***********************************************************************************
安装php:
要先将apache停止:
[root@shunzi ~]# /usr/local/apache/bin/apachectl stop
[root@shunzi httpd-2.0.54]# /usr/local/apache/bin/apachectl stop
[root@shunzi php]# ./configure
--prefix=/usr/local/php --with-mysql=/usr/local/mysql
--with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars
--enable-ftp --enable-inline-optimization
--enable-trans-sid --with-xml --with-gd=/usr/local/gd
--with-png-dir=/usr/local/png --with-zlib-dir=/usr/local/zlibc
--with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype
(事先把png,zlibc,jpeg,freetype安装到/usr/local/下,)

添加到雅虎收藏