http://labs.renren.com/apache-mirror/httpd/httpd-2.2.15.tar.gz
第一步:安装apache
注:当前目录为/tmp,
 目录下有httpd-2.2.4.tar.gz, php-5.2.3.tar.gz等二进制源码包
 #号代表为root 根权限,#后是输入的一条命令
 执行下列命令
 解压源码包
 # tar -zxf httpd-2.2.15.tar.gzs
 进入安装目录
 # cd httpd-2.2.15
 配置apache安装信息
 # ./configure --prefix=/pub/httpd   --enable-so --enable-rewrite
 执行make安装
 # make
 # make install
 安装完后
 # vi /pub/httpd/conf/httpd.conf

 找到 DirectoryIndex index.html index.html.var 改为
 DirectoryIndex index.html index.php index.htm
 

 You don't have permission to access / on this server.
 <Directory />
     Options FollowSymLinks
     AllowOverride None
     Order deny,allow
     deny from all
     Satisfy all
 </Directory>
 然后试着把deny from all中的deny改成了allow,保存后重起了apache,然后再一测试我的网页,哈哈!居然问题就出在这,访问测试网站完全正常了。
三:安装mysql
http://dev.mysql.com/downloads/
 tar -zvxf mysql-5.1.30.tar.gz
 # groupadd mysql
 # useradd -g mysql mysql
 # cd  mysql-5.1.30
 # ./configure --prefix=/pub/mysql --with-charset=gb2312
 # make
 # make install
 # cp /pub/mysql/support-files/my-medium.cnf /etc/my.cnf
 # ./scripts/mysql_install_db --user=mysql
 #./scripts/mysql_install_db --user=mysql --datadir=/pub/mysql/var/
 然后设置权限
 #cd /pub/mysql
 # chown -R root . #设定root能访问/pub/mysql
 # chown -R mysql var #设定mysql用户能访问/usr/local/mysql/var ,里面存的是mysql的数据库文件
 # chown -R mysql var/. #设定mysql用户能访问/usr/local/mysql/var下的所有文件
 # chown -R mysql var/mysql/. #设定mysql用户能访问/usr/local/mysql/var/mysql下的所有文件
 # chgrp -R mysql . #设定mysql组能够访问/usr/local/mysql
 启动mysql服务
 # /pub/mysql/bin/mysqld_safe --user=mysql&
 # /pub/mysql/bin/mysqld_safe --skip-name-resolve --user=mysql&
 如出现 Starting mysqld daemon with databases from /usr/local/mysql/data
 代表正常启动mysql服务了, 按Ctrl + C 跳出
 修改 mysql 的 root 密码
 # /pub/mysql/bin/mysqladmin -u root -p password "wsdewijdjdas2"
  [root@localhost mysql5]# 090511 17:38:40 mysqld_safe Logging to '/pub/mysql/var/localhost.err'.
  090511 17:38:40 mysqld_safe Starting mysqld daemon with databases from /opt/lamp/mysql5/var
  090511 17:38:40 mysqld_safe mysqld from pid file /pub/mysql/var/localhost.pid ended
  [1]+   Done                    bin/mysqld_safe --user=mysql
  解决方法
  1.去/etc/my.cnf文件中把skip-federated注释掉后
  2.cat /pub/mysql/var/localhost.err
四:安装GD库(让PHP支持GIF,PNG,JPEG)
首先下载 jpeg6,libpng,freetype 并安装模块
wget http://down1.chinaunix.net/distfiles/jpegsrc.v6b.tar.gz
a.安装 jpeg6
建立目录:
# mkdir -p /pub/jpeg6
# mkdir -p /pub/jpeg6/bin
# mkdir -p /pub/jpeg6/lib
# mkdir -p /pub/jpeg6/include
# mkdir -p /pub/jpeg6/man
# mkdir -p /pub/jpeg6/man1
# mkdir -p /pub/jpeg6/man/man1
# cd /pub/tool
# tar -zvxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/pub/jpeg6/ --enable-shared --enable-static
# make; make install
wget http://nchc.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8.tar.gz
  http://down1.chinaunix.net/distfiles/libpng-1.2.10.tar.bz2
b.安装libpng
# cd /pub/tool
# tar -zvxf libpng-1.2.8.tar.gz
# cd libpng-1.2.8
# cp scripts/makefile.std makefile
# make; make install
wget http://keihanna.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.10.tar.gz
wget http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.3.7.tar.gz
c.安装 freetype
# cd /pub/tool
# tar -zvxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# mkdir -p /pub/freetype
# ./configure --prefix=/pub/freetype
# make;make install
wget http://google-desktop-for-linux-mirror.googlecode.com/files/zlib-1.2.3.tar.gz
d.:安装zlib
# cd /pub/tool
#tar -zxvf zlib-1.2.3.tar.gz
#cd zlib/1.2.3
# ./configure
# make;make install

wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
e.安装GD库
# cd /pub/tool
# tar -zvxf gd-2.0.33.tar.gz
# mkdir -p /pub/gd2
# cd gd-2.0.33
# ./configure --prefix=/pub/gd2 --with-jpeg=/pub/jpeg6/ --with-png=/pub/lib/ --with-zlib=/pub/lib/ --with-freetype=/pub/freetype/
# make; make install
wget http://down1.chinaunix.net/distfiles/curl-7.19.4.tar.bz2
f.安装Curl库
# cd /pub/tool
# tar -jxvf curl-7.15.0.tar.gz
# mkdir -p /pub/curl
# ./configure --prefix=/pub/curl
# make; make install
五:安装php5,php5必须有libxml2支持!
a.安装libxml2
wget http://down1.chinaunix.net/distfiles/libxml2-2.7.4.tar.gz
# cd /pub/tool
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# mkdir -p /pub/libxml2
# ./configure --prefix=/pub/libxml2
# make; make install
wget http://down1.chinaunix.net/distfiles/libxslt-1.1.23.tar.gz
b.安装 libxslt(可选安装,你可以不安装)
# cd /pub/tool
# tar -zxf libxslt-1.1.15.tar.gz
# mkdir -p /pub/libxslt
# cd libxslt-1.1.15
# ./configure --prefix=/pub/libxslt --with-libxml-prefix=/pub/libxml2
# make; make install
wget http://cn2.php.net/distributions/php-5.3.2.tar.gz
c.安装php5
# cd /pub/tool
# tar -zvxf php-5.3.2.tar.gz
# cd php-5.3.2
# ./configure --prefix=/pub/php5 --with-mysql=/pub/mysql --with-apxs2=/pub/httpd/bin/apxs --with-iconv --with-gmp --with-curl=/pub/curl --with-gd=/pub/gd2 --with-zlib --with-freetype-dir=/pub/freetype --with-jpeg-dir=/pub/jpeg6 --with-pdo-mysql=/pub/mysql --with-libxml-dir=/pub/libxml2 --enable-bcmath --with-xsl --enable-ftp --enable-pcntl --enable-mbstring
# make
//make clean
# make install
六:重新配置apache2让他支持php。
配置 httpd.conf 让apache支持PHP
# vi /usr/local/apache/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

重启apache
# /usr/local/apache/bin/apachectl restart