先卸载原来安装的apache
yum remove httpd
1、使用 yum 程序安装所需开发包(以下为标准的 RPM 包名称)
#
yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel libxml2-devel libcurl-devel curl-devel net-snmp-devel
#
这里我们将编译GD所必须的一些小软件比如libpng,libtiff,freetype,libjpeg等先用RPM的方式一并安装好,避免手动编译浪费时间,同时也能避免很多错误,这几个小软件的编译很麻烦。这几个小软件编译错误了,GD当然安装不了,php5的编译当然也没戏了。所以我们抓大放小,对这些小牛鬼蛇神采取快速简洁的方式进行安装。并且对服务器的性能也不能产生什么影响。
2、源码编译安装所需包 (Source)
(1) GD2
#
cd /usr/local/src
# wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
#
tar xzvf gd-2.0.33.tar.gz
#
cd gd-2.0.33
#
./configure –prefix=/usr/local/gd2 –mandir=/usr/share/man //./configure 配置。
#
make //make 是用来编译的,它从 Makefile 中读取指令,然后编译。
#
make install //make install 是用来安装的,它也从 Makefile 中读取指令,安装到指定的位置。
#
cd ../
(2) Apache 日志截断程序
#
cd /usr/local/src
# wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
#
tar xzvf cronolog-1.6.2.tar.gz
#
cd cronolog-1.6.2
#
./configure –prefix=/usr/local/cronolog
#
make
#
make install
#
cd ../
(3) libxml 库程序
#
cd /usr/local/src
# wget http://ftp.gnome.org/pub/gnome/sources/libxml2/2.6/libxml2-2.6.26.tar.gz
#
tar zxvf libxml2-2.6.26.tar.gz
#
cd libxml2-2.6.26
#
./configure –prefix=/usr/local/libxml2
#
make
#
make install
#
cd ../
接下来进入正题,
建议安装顺序Mysql,Apache,PHP
#
tar zxvf httpd-2.4.2.tar.gz
#
cd httpd-2.4.2
[root@localhost httpd-2.4.2]#
./configure --prefix=/usr/local/httpd-apache/ --enable-ssl --enable-cgi --enable-mods-shared=allable-ssl --enable-cgi --enable-mods-shared=all --with-ssl=/usr/local/openssl/ --enable-track-vars --enable-rewrite
checking for APR... no
configure: error: APR not found. Please read the documentation.
下载安装
http://apr.apache.org/download.cgi =>
http://mirror.bjtu.edu.cn/apache//apr/apr-1.4.6.tar.gz
tar zxvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure
make && make install
cd ../
继续安装apache
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
下载安装
http://apr.apache.org/download.cgi =>
http://mirror.bjtu.edu.cn/apache//apr/apr-util-1.4.1.tar.gz
(http://mirror.bjtu.edu.cn/apache//apr/apr-iconv-1.2.1.tar.gz)
tar zxvf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --with-apr=/usr/local/apr
make && make install
cd ../
继续安装apache
configure: error: pcre-config for libpcre not found. PCRE is required and available from
http://pcre.org/
下载安装 pcre http://pcre.org ==>
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
tar zxvf pcre-8.30.tar.gz
cd pcre-8.30
./configure --with-apr=/usr/local/apr
make && make install
cd ../
再次安装apache
./configure --prefix=/usr/local/httpd-apache/ --enable-ssl --enable-cgi --enable-mods-shared=allable-ssl --enable-cgi --enable-mods-shared=all --with-ssl=/usr/local/openssl/ --enable-track-vars --enable-rewrite
make && make install
cd ../
cd ../httpd-apache
#启动
[root@localhost httpd-apache]#
/usr/local/httpd-apache/bin/apachectl start
[root@localhost httpd-apache]#
netstat -utl
#然后打开浏览器,输入“ http://localhost”
#出现“It Works!”
至此,安装成功。