Centos7 安装 Apache-2.4.38

Centos7 编译安装 Apache-2.4.38

一、从官网下载源码

wget http://www.apache.org/dist/httpd/httpd-2.4.38.tar.bz2
wegt http://mirror.bit.edu.cn/apache//apr/apr-1.7.0.tar.gz
wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

二、减压软件包,编译安装

  • 2.1 减压httpd-2.4.38.tar.bz2 apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz
  • 2.2 将 apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz 重命名为 apr apr-util
  • 2.3 ```cp -a apr/ apr-uril````到/httpd-2.4.38/srclib 中
  • 2.4 而后使用./configure进行编译
./configure --prefix=/usr/local/httpd --sysconfdir=/etc/http --with-included-apr

三、而后进行安装便可make &&make install

四、若在make 时出现以下错误

xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
 #include <expat.h>

需要编译安装expat软件包,步骤以下:git

4.1 下载expat 软件包

wget https://github.com/libexpat/libexpat/releases/download/R_2_2_7/expat-2.2.7.tar.bz2

4.2 安装expat

./configure --prefix = / path-to-expat-installation-dir
make && make install

4.3 而后回到httpd目录下加上以下参数从新编译再安装便可

--with-expat = / path-to-expat-installation-dir

PS:安装的Httpd 为最新版软件包。github

相关文章
相关标签/搜索