1、安装gcc编译器(查看gcc -v版本)
yum -y install gcc gcc-c++ autoconf pcre pcre-devel makeautomake
2、安装gmp
解压缩 tar -jxvf gmp-6.1.2.tar.bz2
cd gmp-6.1.2
mkdir temp
cd temp
../configure --prefix=/usr/local/gmp-6.1.2--build=x86_64-linux
make
make install
3、安装mpfr
解压缩 tar -zxvf mpfr-4.0.1.tar.gz
cd mpfr-4.0.1
mkdir temp
cd temp
../configure --prefix=/usr/local/mpfr-4.0.1
--with-gmp=/usr/local/gmp-6.1.2
make
make install
4、安装mpc
解压缩 tar -zxvf mpfr-4.0.1.tar.gz
cd mpfr-4.0.1
mkdir temp
cd temp
../configure --prefix=/usr/local/mpc-1.0.3
--with-gmp=/usr/local/gmp-6.1.2--with-mpfr=/usr/local/mpfr-4.0.1
make
make install
5、安装出现问题:configure: error: APR not found . Please read thedocumentation!
下载wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wgethttp://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wgethttp://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
(1)安装apr
tar -zxvf apr-1.4.5.tar.gz
cd apr-1.4.5
./configure --prefix=/usl/local/apr
make
make install
(2)安装apr-util
tar -zxvf apr-util-1.3.12.tar.gz
cd apr-util-1.3.12
./configure --prefix=/usl/local/apr-util
make
make install
可能出现的错误:xml/apr_xml.c:35:19: error: expat.h: No such file ordirectory
解决办法需要安装expat库:yum install expat-devel
(3)安装pcre
tar -zxvf pcre-8.10.tar.gz
cd pcre-8.10
./configure --prefix=/usr/local/pcre
make
make install
6、开始安装apache服务
tar -zxvf http.2.4.29.tar.gz
cd http.2.4.29
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util--with-pcre=/usr/local/pcre
make
make install
7、启动apache
/usr/local/apache/bin/apachectl start
可能出现问题:httpd: Could not reliably determine the server's fullyqualified domain name
解决办法:vi/usr/local/apache/conf/httpd.conf,搜索"#ServerName",添加ServerNamelocalhost:80,重启apache:/usr/local/apache/bin/apachectl restart
8、修改默认根目录
vi /usr/local/apache/conf/httpd.conf
找到下面位置,修改DocumnetRoot和Directory,然后重启apache