Apache的安装

进入/usr/local/src/

cd /usr/local/src

下载httpd-2.2.34.tar.bz2

wget http://mirrors.sohu.com/apache/httpd-2.2.34.tar.bz2

解压压缩包

tar -jxvf httpd-2.2.34.tar.bz2

创建Apache安装目录/usr/local/apache2

mkdir /usr/local/apache2

配置Apache安装信息

cd httpd-2.2.34

./configure \

--prefix=/usr/local/apache2/ \

--with-included-apr \

--enable-so \

--enable-deflate=shared \

--enable-expires=shared \

--enable-rewrite=shared \

--with-pcre


参数解释:

--prefix=/usr/local/apache2/     指定Apache安装路径

--with-included-apr                  使用捆绑apr的副本(可以不装)

--enable-so                              以动态共享对象编译(必须安装)

--enable-deflate=shared          缩小传输编码的支持

--enable-expires=shared         期满头控制

--enable-rewrite=shared         基于规则的url操控

--with-pcre                               依赖pcre


编译Apache

make

安装Apache

make install



问题集锦:

在./configure过程中,可能会出现如下错误

错误1: 

error: no acceptable C compiler found in $PATH

原因:缺少C编译器

解决:安装gcc

yum –y install gcc

错误2:

error: mod_deflate has been requested but can not be built due to prerequisite failures

解决:

yum install  zlib-devel

小建议

为了避免在make的时候出现错误,所以最好是提前先安装好一些库文件:

yum install -y pcre pcre-devel apr apr-devel

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • php+mysql+apache+centos 编译安装 领导要求先保证php环境稳定,然后再去考虑其他,例如性能...
    dnaEMx阅读 6,682评论 1 16
  • 一、LAMP环境的介绍 1.LAMP环境的重要性 思索许久,最终还是决定写一篇详细的LAMP的源码编译安装的实验文...
    endmoon阅读 7,535评论 4 26
  • 1、确认搭建LAMP所需的环境是否已经安装: [root@localhost ~]#rpm -q make gcc...
    4e855d444c9f阅读 3,297评论 0 0
  • 我们现在分以下步骤进行安装apache: 1、 安装编译环境 2、 卸载原有apache 3、 下载解压源码包 4...
    大眼杰的世界阅读 5,869评论 0 2
  • 不谈日间的事 天就晚了 房子里有个爱你的女人 心就安了 包括我在内 那些胸无大志的人们 希望我们宁静如相爱的男女 ...
    勒尤阅读 1,495评论 0 1