apache编译参数:./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-ssl
mysql编译参数:./configure --prefix=/usr/local/mysql --localstatedir=/var/db/mysql
php编译参数:./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-force-cgi-redirect --disable-debug --with-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-curl --with-exec-dir=/usr/bin --with-gd --enable-gd-native-ttf --with-ttf --with-gettext --with-ncurses --with-gmp --with-iconv --with-jpeg-dir --with-openssl --with-regex=system --enable-xml --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-discard-path --enable-wddx --without-oci8 --enable-ucd-snmp-hack --enable-bcmath --enable-shmop --enable-calendar --enable-mbstring

详细安装配置如下:

Mysql安装配置如下:
1.tar -zxvf mysql.4.0.26.tar.gz

2.mkdir /var/db/mysql

chmod 0775 /var/db/mysql

chown mysql mysql

chgrp mysql mysql

2. ./configure –prefix=/usr/local/mysql –localstatedir=/var/db/mysql

make

make install

4. cd /usr/local/mysql/bin

./mysql_install_db –user=mysql & (安装初始化数据库和数据表)

./mysqld_safe –user=mysql &(来启动mysql数据库)

./mysql -uroot -p(初始化mysql登录密码为空,所以安全起尽要设置密码)

其设置密码有三种方法:

a. ./mysqladmin -u root -p oldpassword newpasswd(记住这个命令是在/usr/local/mysql/bin中外部命令)

b. SET PASSWORD FOR root=PASSWORD(‘new password’);(对登录数据库后这种方式)

c. UPDATE user SET password=PASSWORD(“new password”) WHERE user=’root’;  (对登录数据库后这种方式)

最后一步也是就将mysql设置到服务器自动,以便于有什么问题服务器启动不需要去启动mysql,有两种方法:

1.vi /etc/rc.local 加入/usr/local/mysql/bin/mysqld_safe –user=mysql & 或是mysqld_safe –user=mysql &

2.将原来编译原文件目录中support-files/mysql.server文件复制到更名为/etc/init.d/mysql ]

chkconfig –add mysql 将服务加到服务后台中进行自启动

Apache安装配置:

1. tar -zxvf apache2.0.55.tar.gz
2. cd apache2.0.55
./configure –prefix=/usr/local/apache –enable-mods-shared=all –enable-ssl
make
make install

启动apache如下:

apachectl start

httpd -k start

上面两种都有可以的.现在我们做的就是把这个apache服务加入自启动服务中如下:

vi /etc/rc.local /usr/local/apache/bin/apachectl start

加入服务自身后台服务中进行自动启动其代码如下:

#!/bin/bash
# Startup script for the Apache Web Server
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.

/etc/rc.d/init.d/functions
/etc/sysconfig/network
[ "${NETWORKING}" = "no" ] && exit 0
APACHE=/usr/local/apache
start() {
echo $”Starting httpd service: ”
$APACHE/bin/apachectl start
RETVAL=$?
echo
}

stop() {
echo $”Stopping httpd service: ”
$APACHE/bin/apachectl stop
RETVAL=$?
echo
}

case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $”Usage: $0 start|stop|restart”
exit 1
esac
exit 0

复制上面一个代码到/etc/init.d/httpd 这个文件是新建,然后把chmod 0775 httpd和chmod 0775 /etc/sysconfig/network(这个文件可能不需要修改权限,和你自身服务器有关)

chkconfig –add httpd 加入台后服务已经成功

PHP安装和配置:

tar -zxvf php-5.2.5.tar.gz

./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –enable-force-cgi-redirect –disable-debug –with-pic –disable-rpath –enable-inline-optimization –with-bz2 –with-curl –with-exec-dir=/usr/bin –with-gd –enable-gd-native-ttf –with-ttf –with-gettext –with-ncurses –with-gmp –with-iconv –with-jpeg-dir –with-openssl –with-regex=system –enable-xml –with-zlib –with-layout=GNU –enable-bcmath –enable-exif –enable-ftp –enable-magic-quotes –enable-safe-mode –enable-sockets –enable-sysvsem –enable-sysvshm –enable-discard-path –enable-wddx –without-oci8 –enable-ucd-snmp-hack –enable-bcmath –enable-shmop –enable-calendar –enable-mbstring

make

make install

apache2.0.55.tar.gz 下载

php4.4.1.tar.gz 下载

mysql4.0.26.tar.gz 下载

最后大家为了能方便使用一些命令就把设置环境变量:

export PATH=$PATH:/usr/local/mysql/bin

export PATH=$PATH:/usr/local/apache/bin

export PATH=$PATH:/usr/local/php/bin