阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Linux实验报告-源代码编译安装Apache

137次阅读
没有评论

共计 2090 个字符,预计需要花费 6 分钟才能阅读完成。

实验背景:
程序源代码编译安装通常需要如下三个步骤:./configure à make à make install

第一步:执行源代码路径下的 configure 脚本
此步骤的目的是:a,检查编译环境是否完备;b,通过 configure 脚本选项使用户可以定制编译配置,如 –prefix=PATH 指定程序安装路径
第二步:make 命令    # 自动执行编译
第三步:make install 命令    #将编译好的程序放入指定的路径或默认路径下

实验目的:
通过源代码编译安装 Apache,并开启此服务。最后测试 web 服务是否开启。

实验环境:
VmwareWorkstation 9,CentOS 6.4,httpd-2.4.7.tar.gz

实验步骤:
1,下载 Apache 的主程序包 httpd。
(官网 http://httpd.apache.org 或是其它镜像网站下载)
2,解压出源程序,并进入源程序目录

Linux 实验报告 - 源代码编译安装 Apache

在源程序目录下通常有 INSTALL、README 等文件,在安装之前可以先查看一下这些文件。比如 INSTALL 文件记录了此程序的安装步骤,告知了完整的编译安装步骤参考网址:http://httpd.apache.org/docs/2.4/install.html

Linux 实验报告 - 源代码编译安装 Apache

3,执行 configure 脚本,开始检查编译环境

Linux 实验报告 - 源代码编译安装 Apache

正常执行结束,没有 error 信息即可
4,自动执行编译
[root@localhost httpd-2.4.7]# make
5,安装已编译完成的程序
[root@localhost httpd-2.4.7]# make install
默认是安装在 /usr/local/apache2/bin 目录下
6,开启 Apache 服务
[root@localhost httpd-2.4.7]#/usr/local/apache2/bin/apachectl start

Linux 实验报告 - 源代码编译安装 Apache

7,测试成功

Linux 实验报告 - 源代码编译安装 Apache

此 web page 的路径通常在 PREFIX/htdocs/.

实验中遇到的问题:
1,Q:执行 configure 脚本时,异常退出,报错信息:configure: error: APR not found.Please read the documentation.
    A:查看 Apache 的编译安装说明(http://httpd.apache.org/docs/2.4/install.html),其中 Requirements 中指出安装 Apache 之前,系统上需安装 APR 和 APR-Util。按照操作说明,下载 APR 和 APR-Until 源程序包,并解压缩至 Apache 源程序目录下的./srclib/apr 和 ./srclib/apr-util 目录下。再次执行 configure 脚本即可顺利通过。(或者分别编译安装 APR 和 APR-Util 源程序包后也可以正常执行 configure 脚本)
2,Q:执行 configure 脚本时,异常退出,报错信息:configure: error: pcre-config for libpcre not found. PCRE isrequired and availbe from http://pcre.org/
    A:同理,下载 pcre 源程序包,编译安装后,即可解决。
3,Q:编译安装完成 Apache 并开启服务后,浏览器中输入 http://locahost 可验证成功,但是 http:// 本机 IP 无法访问。

Linux 实验报告 - 源代码编译安装 Apache

    A:通过命令 serviceiptables stop 临时禁用防火墙,即可正常访问。
(但是接下来即使再 start iptables, 甚至 apachectl stop,此网页仍可访问,像是访问的是缓存,如何清除?)
If you have the default firewall rules enabledyou will not be able to access Apache without some additional configuration.The simplest solution is to run the system-config-firewall tool and check the’WWW (HTTP)` checkbox.
You can also disable the firewalltemporarily by running:
service iptables stop

相关阅读

日志分析工具 Awstats 实战之 Apache 篇 - 多站点日志分析 http://www.linuxidc.com/Linux/2013-11/92273.htm

在 Ubuntu 13.10 下安装支持 SSL 的 Apache http://www.linuxidc.com/Linux/2013-11/92266.htm

再谈伪装 Apache 版本防止入侵 Web 服务器 http://www.linuxidc.com/Linux/2013-10/91179.htm

Apache Python 模块 mod_wsgi 的编译安装 http://www.linuxidc.com/Linux/2013-09/90637.htm

企业 Shell 脚本分析及切割 Apache 日志实战 http://www.linuxidc.com/Linux/2013-09/90627.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计2090字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中