Linux系统安装Appach 2.4.6

转载链接:http://www.cnblogs.com/kerrycode/p/3261101.html

Apache简介

 

        Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行,由于其多平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩展,将Perl/Python等解释器编译到服务器中。关于更多Apache的介绍,可以参考百科“http://baike.baidu.com/view/28283.htm或官网http://www.apache.org/http://httpd.apache.org/的介绍

 

Apache软件下载

  Apache的相关软件包下载地址http://apr.apache.org/projects.html

1.   Apache HTTP Server

    截止目前为止,Apache HTTP Server 目前最新的版本是 Apache httpd 2.4.6 Released, 下载地址:http://httpd.apache.org/download.cgi#apache24

2.   APR and APR-Util包

    截止目前为止,APR and APR-Util的最新版本如下,下载地址:http://apr.apache.org/download.cgi

  • APR 1.4.8, released June 21, 2013
  • APR-util 1.5.2, released April 4, 2013
  • APR-iconv 1.2.1, released November 26, 2007

3.   PCRE包

   截止目前为止,PCRE最新的包为8.33,下载地址如下

  • https://sourceforge.net/projects/pcre/files/pcre/

 

  可以下载了相关安装包,上传到/root/kerry这个临时目录。也可以直接通过wget下载

Apache安装要求

下面是官方文档的要求,必须安装APR、APR-Util、PCRE,gcc-c++等包,文档URL地址http://httpd.apache.org/docs/2.4/install.html

 

Requirements

The following requirements exist for building Apache httpd:

APR and APR-Util

Make sure you have APR and APR-Util already installed on your system. If you don't, or prefer to not use the system-provided versions, download the latest versions of both APR and APR-Util from Apache APR, unpack them into ./srclib/apr and ./srclib/apr-util (be sure the directory names do not have version numbers; for example, the APR distribution must be under ./srclib/apr/) and use ./configure's --with-included-apr option. On some platforms, you may have to install the corresponding -dev packages to allow httpd to build against your installed copy of APR and APR-Util.

Perl-Compatible Regular Expressions Library (PCRE)

This library is required but not longer bundled with httpd. Download the source code from http://www.pcre.org, or install a Port or Package. If your build system can't find the pcre-config script installed by the PCRE build, point to it using the --with-pcre parameter. On some platforms, you may have to install the corresponding -dev package to allow httpd to build against your installed copy of PCRE.

Disk Space

Make sure you have at least 50 MB of temporary free disk space available. After installation the server occupies approximately 10 MB of disk space. The actual disk space requirements will vary considerably based on your chosen configuration options, any third-party modules, and, of course, the size of the web site or sites that you have on the server.

ANSI-C Compiler and Build System

Make sure you have an ANSI-C compiler installed. The GNU C compiler (GCC) from the Free Software Foundation (FSF) is recommended. If you don't have GCC then at least make sure your vendor's compiler is ANSI compliant. In addition, your PATH must contain basic build tools such as make.

Accurate time keeping

Elements of the HTTP protocol are expressed as the time of day. So, it's time to investigate setting some time synchronization facility on your system. Usually thentpdate or xntpd programs are used for this purpose which are based on the Network Time Protocol (NTP). See the NTP homepage for more details about NTP software and public time servers.

Perl 5 [OPTIONAL]

For some of the support scripts like apxs or dbmmanage (which are written in Perl) the Perl 5 interpreter is required (versions 5.003 or newer are sufficient). If you have multiple Perl interpreters (for example, a systemwide install of Perl 4, and your own install of Perl 5), you are advised to use the --with-perl option (see below) to make sure the correct one is used by configure. If no Perl 5 interpreter is found by the configure script, you will not be able to use the affected support scripts. Of course, you will still be able to build and use Apache httpd.

 

Apache安装过程

 

Step 1:安装包gcc或gcc-c++

[root@getlnx05 pcre-8.33]# yum list gcc-c++

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Available Packages

gcc-c++.x86_64                                                               4.1.2-51.el5                                                                rhel-debuginfo

[root@getlnx05 pcre-8.33]# yum list gcc

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Installed Packages

gcc.x86_64                                                                    4.1.2-51.el5                                                                    installed

[root@getlnx05 pcre-8.33]# rpm -q gcc

gcc-4.1.2-51.el5

从上面可见gcc包已经安装,缺少gcc-c++包,那么接下来安装包gcc-c++,如果此处不安装该包,后面安装过程中会报错

[root@getlnx05 pcre-8.33]#yum install  gcc-c++

 

Step 2:安装包APR和APR-Util

[root@getlnx05 kerry]# ls apr*

apr-1.4.8.tar.gz  apr-util-1.5.2.tar.gz

[root@getlnx05 kerry]#

[root@getlnx05 kerry]# tar -zxf apr-1.4.8.tar.gz

[root@getlnx05 kerry]# cd apr-1.4.8

[root@getlnx05 apr-1.4.8]# ls

clip_image002

新建目录/usr/local/apr,用作安装目录:

[root@getlnx05 apr-1.4.8]# mkdir /usr/local/apr

[root@getlnx05 apr-1.4.8]# ./configure --prefix=/usr/local/apr

clip_image004

[root@getlnx05 apr-1.4.8]# make

[root@getlnx05 apr-1.4.8]# make install

clip_image006

安装完成后,可以验证一下

[ root@getlnx05 apr]# ls -lrt

total 32

drwxr-xr-x 3 root root 4096 Aug 15 06:57 include

drwxr-xr-x 3 root root 4096 Aug 15 06:57 lib

drwxr-xr-x 2 root root 4096 Aug 15 06:57 build-1

drwxr-xr-x 2 root root 4096 Aug 15 06:57 bin

[root@getlnx05 kerry]# mkdir /usr/local/apr-util

[root@getlnx05 kerry]# tar -zxf apr-util-1.5.2.tar.gz

[root@getlnx05 kerry]# cd apr-util-1.5.2

clip_image008

[root@getlnx05 apr-util-1.5.2]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config

clip_image010

[root@getlnx05 apr-util-1.5.2]# make

[root@getlnx05 apr-util-1.5.2]# make install

clip_image012

 

Step 3:安装包PRCE

[root@getlnx05 kerry]# unzip pcre-8.33.zip

[root@getlnx05 kerry]# cd pcre-8.33

[root@getlnx05 kerry]#mkdir /usr/local/pcre

[root@getlnx05 pcre-8.33]# ./configure --prefix= /usr/local/pcre--with-apr=/usr/local/apr/bin/apr-1-config

clip_image014

[root@getlnx05 pcre-8.33]# make

[root@getlnx05 pcre-8.33]# make install

clip_image016

 

Step 4:安装Apache Http Server

[root@getlnx05 kerry]# tar zxvf httpd-2.4.6.tar.gz

[root@getlnx05  kerry]#cd httpd-2.4.6

[root@getlnx05 httpd-2.4.6]# ./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

[root@getlnx05 httpd-2.4.6]#make

[root@getlnx05 httpd-2.4.6]#make install

Step 5:启动Apache服务

[root@getlnx05 httpd-2.4.6]#  /usr/local/apache/bin/apachectl start

用浏览器访问http://localhost时提示It works!

 

 

Apache安装问题锦集

 

问题1:缺少包gcc-c++导致安装包apr-util不通过

 

[root@getlnx05 kerry]# unzip pcre-8.33.zip

[root@getlnx05 kerry]# cd pcre-8.33

[root@getlnx05 pcre-8.33]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config

clip_image018

一般出现这个错误是因为没有安装包gcc-c++,可以通过如下命令检查,

[root@getlnx05 pcre-8.33]# yum list gcc-c++

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Available Packages

gcc-c++.x86_64                                                               4.1.2-51.el5                                                                rhel-debuginfo

[root@getlnx05 pcre-8.33]# yum list gcc

Loaded plugins: product-id, security, subscription-manager

Updating Red Hat repositories.

Installed Packages

gcc.x86_64                                                                    4.1.2-51.el5                                                                    installed

[root@getlnx05 pcre-8.33]# rpm -q gcc

gcc-4.1.2-51.el5

[root@getlnx05 pcre-8.33]# rpm -q gcc-c++

 

问题2:checking for APR-util... configure: error: the --with-apr-util parameter is incorrect

[root@getlnx05 httpd-2.4.6]#  ./configure --prefix=/usr/local/apache  --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

checking for chosen layout... Apache

checking for working mkdir -p... yes

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

configure:

configure: Configuring Apache Portable Runtime library...

configure:

checking for APR... yes

  setting CC to "gcc"

  setting CPP to "gcc -E"

  setting CFLAGS to " -g -O2 -pthread"

  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"

  setting LDFLAGS to " "

configure:

configure: Configuring Apache Portable Runtime Utility library...

configure:

checking for APR-util... configure: error: the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.

[root@getlnx05 httpd-2.4.6]#

一般是由于APR-util没有安装成功,可以通过验证该目录是否为空来判断,因为你有时候执行了make,忘了执行make isntall命令有可能导致这个错误。

[root@getlnx05 apr]# cd /usr/local/apr-util

[root@getlnx05 apr-util]# ls

 

问题3:没有指定PCRE参数

[root@getlnx05 httpd-2.4.6]#  ./configure --prefix=/usr/local/apache  --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

checking for chosen layout... Apache

checking for working mkdir -p... yes

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

configure:

configure: Configuring Apache Portable Runtime library...

configure:

checking for APR... yes

  setting CC to "gcc"

  setting CPP to "gcc -E"

  setting CFLAGS to " -g -O2 -pthread"

  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"

  setting LDFLAGS to " "

configure:

configure: Configuring Apache Portable Runtime Utility library...

configure:

checking for APR-util... yes

checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking how to run the C preprocessor... gcc -E

checking for gcc option to accept ISO C99... -std=gnu99

checking for pcre-config... false

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

[root@getlnx05 httpd-2.4.6]#

 

问题4:安装前忘了先安装APR相关包

[root@getlnx05 httpd-2.4.6]#  ./configure --prefix=/usr/local/appache/

checking for chosen layout... Apache

checking for working mkdir -p... yes

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

configure:

configure: Configuring Apache Portable Runtime library...

configure:

checking for APR... no

configure: error: APR not found.  Please read the documentation.

[root@getlnx05 httpd-2.4.6]#

 

问题5:启动服务时报错

[root@getlnx05 httpd-2.4.6]#  /usr/local/apache/bin/apachectl start

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using getlnx05.gfg1.esquel.com. Set the 'ServerName' directive globally to suppress this message

这个时候需要编辑httpd.conf配置文件,添加SeraverName的具体IP地址。如下所示

[root@getlnx05 conf]# cd /usr/local/apache/conf/

[root@getlnx05 conf]# ls

extra  httpd.conf  magic  mime.types  original

[root@getlnx05 conf]# vi httpd.conf

ServerAdmin you@example.com

#

# ServerName gives the name and port that the server uses to identify itself.

# This can often be determined automatically, but we recommend you specify

# it explicitly to prevent problems during startup.

#

# If your host doesn't have a registered DNS name, enter its IP address here.

#

#ServerName www.example.com:80

ServerName 192.168.9.122:80

#

# Deny access to the entirety of your server's filesystem. You must

# explicitly permit access to web content directories in other

# <Directory> blocks below.

#

"httpd.conf" 502L, 18179C written

[root@getlnx05 conf]# /usr/local/apache/bin/apachectl restart

httpd not running, trying to start

[root@getlnx05 conf]# /usr/local/apache/bin/apachectl start

httpd (pid 7797) already running

如果从其它电脑连接访问Apache时,输入url地址:http://192.168.9.122页面没有显示正常,而上面配置也OK,那么你必须关闭防火墙,有时候甚至需要重启电脑才能OK,重启Apache服务都无效。

[root@getlnx05 conf]# chkconfig iptables off

[root@getlnx05 conf]# chkconfig iptables off

[root@getlnx05 conf]# /usr/local/apache/bin/apachectl restart

[root@getlnx05 conf]# /usr/local/apache/bin/apachectl restart

[root@getlnx05 conf]#

 

作者:潇湘隐者
出处:http://www.cnblogs.com/kerrycode/

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/276459.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

学习 redux 源码整体架构,深入理解 redux 及其中间件原理

如果觉得内容不错&#xff0c;可以设为星标置顶我的公众号1. 前言你好&#xff0c;我是若川。这是学习源码整体架构系列第八篇。整体架构这词语好像有点大&#xff0c;姑且就算是源码整体结构吧&#xff0c;主要就是学习是代码整体结构&#xff0c;不深究其他不是主线的具体函数…

pdf安装包_有么有pdf控件,不需要用户安装任何安装包直接打印的?

如果开发一个软件&#xff0c;需要用到PDF功能&#xff0c;您的选择是基于Adobe PDF吗&#xff1f; 如果是基于Adobe PDF&#xff0c;需要用户安装一个几十M的Adobe的安装包&#xff0c;这显然是不友好的。即使目前也有了一些其它的阅读器&#xff0c;大小也还好。但是&#xf…

[转] C#异步操作

Title 通过委托实现异步调用中BeginInvoke及回调函数的使用 通过委托实现异步调用的步骤&#xff1a; 1.定义委托。 2.将要进行异步调用的方法“实例化”到定义的委托。 3.在委托上调用BeginInvoke方法。其中&#xff0c;BeginInvoke的参数由三个部分构成。第一部分&#xff1…

HTTP Server Error 500 内部服务器错误

问题&#xff1a;HTTP500错误 或 Server Application Error ------------------------------------Server Application ErrorThe server has encountered an error while loading an application during the processing of your request. Please refer to the event log for mo…

使用 ohmyzsh 打造 windows、ubuntu、mac 系统高效终端命令行工具

如果觉得内容不错&#xff0c;可以设为星标置顶我的公众号原标题名&#xff1a;oh my zsh 和 windows git bash 设置别名提高效率写于2018年06月03日在我的微信交流群中听闻很多前端开发比较贫穷&#xff0c;没有买mac电脑&#xff08;比如我&#xff09;&#xff0c;也没有用过…

request获取mac地址_【Go】获取用户真实的ip地址

原文链接&#xff1a;https://blog.thinkeridea.com/201903/go/get_client_ip.html用户请求到达提供服务的服务器中间有很多的环节&#xff0c;导致服务获取用户真实的 ip 非常困难&#xff0c;大多数的框架及工具库都会封装各种获取用户真实 ip 的方法&#xff0c;在 exnet 包…

iPhone开发四剑客之《Objective-C基础教程》

iPhone 开发四剑客之《Objective-C 基础教程》 Objective-C 语言是 C 语言的一个扩展集&#xff0c;许多&#xff08;可能是大多数&#xff09;具备 Mac OS X 外观的应用程序都是使用该语言开发的。它以 C 语言为基础&#xff0c;添加了一些微妙但意义重大的特性。 苹果公司为…

keras训练完以后怎么预测_还在使用“龟速”的单显卡训练模型?动动手,让TPU节省你的时间...

点击上方关注&#xff0c;All in AI中国本文将介绍如何使用Keras和Google CoLaboratory与TPU一起训练LSTM模型&#xff0c;与本地计算机上的GPU相比&#xff0c;这样训练能大大缩短训练时间。很长一段时间以来&#xff0c;我都在单张GTX 1070显卡上训练我的模型&#xff0c;它的…

手把手教你写个小程序定时器管理库

背景凹凸曼是个小程序开发者&#xff0c;他要在小程序实现秒杀倒计时。于是他不假思索&#xff0c;写了以下代码&#xff1a;Page({init: function () {clearInterval(this.timer)this.timer setInterval(() > {// 倒计时计算逻辑console.log(setInterval)})}, })可是&…

[New Portal]Windows Azure Virtual Machine (14) 在本地制作数据文件VHD并上传至Azure(1)

《Windows Azure Platform 系列文章目录》 之前的内容里&#xff0c;我介绍了如何将本地的Server 2012中文版 VHD上传至Windows Azure&#xff0c;并创建基于该Server 2012 VHD的虚拟机。 我们知道&#xff0c;VHD不仅仅可以保存操作系统&#xff0c;而且可以保存数据文件。 如…

python 退出程序_Python:用Ctrl+C解决终止多线程程序的问题!(建议收藏)

前言&#xff1a;今天为大家带来的内容是Python:用CtrlC解决终止多线程程序的问题&#xff01;文章中的代码具有不错的参考意义&#xff0c;希望在此能够帮助到各位&#xff01;(多数代码用图片的方式呈现出来&#xff0c;方便各位观看与收藏)出发点&#xff1a;前段时间&#…

若川知乎高赞:有哪些必看的 JS 库?

欢迎星标我的公众号&#xff0c;回复加群&#xff0c;长期交流学习我的知乎回答目前2w阅读量&#xff0c;270赞&#xff0c;现在发到公众号声明原创。必看的js库&#xff1f;只有当前阶段值不值看。我从去年7月起看一些前端库的源码&#xff0c;历时一年才写了八篇《学习源码整…

基于EasyUI的Web应用程序及过去一年的总结

前言 一个多月之前已经提交了离职申请&#xff0c;好在领导都已经批准了&#xff0c;过几天就办理手续了&#xff0c;在此感谢领导的栽培与挽留&#xff0c;感谢各位同事在工作中的给我的帮助&#xff0c;离开这个团队确实有一些不舍&#xff0c;不为别的&#xff0c;只因为这个…

快速使用Vue3最新的15个常用API

之前我写了一篇博客介绍了Vue3的新特性&#xff0c;简单了解了一下Vue3都有哪些特色&#xff0c;并且在文末带大家稍微体验了一下Vue3中 Compsition API 的简单使用上一篇文章地址&#xff1a;紧跟尤大的脚步提前体验Vue3新特性&#xff0c;你不会还没了解过Vue3吧因为这个月的…

超级马里奥代码_任天堂的源码泄露,揭示超级马里奥的前世之生

被黑客盯上的任天堂任天堂遭到了史上最大规模的黑客攻击&#xff0c;Wii 完整源码、设计以及《宝可梦》多部作品的信息遭到泄露&#xff0c;而此次泄露事件的后续影响似乎也爆发了出来。《马里奥赛车》和《超级马里奥世界2》(耀西岛)的早期原型视频&#xff0c;以及《超级马里奥…

漫画 | 前端发展史的江湖恩怨情仇

时间总是过得很快&#xff0c; 似乎快得让人忘记了昨天&#xff0c;前端WEB领域的发展更是如此&#xff0c;转眼间已是近30年&#xff0c;时光荏苒&#xff0c;初心不变&#xff0c;在一代又一代前端人的努力下&#xff0c;前端已经是互联网不可或缺的一部分。然而很多前端打工…

10 个你可能还不知道 VS Code 使用技巧

经常帮一些同学 One-on-One 地解决问题&#xff0c;在看部分同学使用 VS Code 的时候&#xff0c;有些蹩脚&#xff0c;实际上一些有用的技巧能够提高我们的日常工作效率。NO.1一、重构代码VS Code 提供了一些快速重构代码的操作&#xff0c;例如&#xff1a;将一整段代码提取为…

构建安全的Xml Web Service系列之如何察看SoapMessage

上一篇文章地址&#xff1a;构建安全的Xml Web Service系列一之初探使用Soap头 (5-22 12:53) 要分析Xml Web Service的安全性&#xff0c;首先要解决的问题是我们能了解和清楚Soap消息的格式和内容&#xff0c;如果获得不了SoapMessage&#xff0c;分析如何能构建安全Xml w…

前端高效开发必备的 js 库梳理

之前有很多人问学好前端需要学习哪些 js 库, 主流框架应该学 vue 还是 react ? 针对这些问题, 笔者来说说自己的看法和学习总结.首先我觉得在学习任何知识之前必须要有一个明确的学习目标, 知道自己为什么要学它, 而不是看网上说的一股脑的给你灌输各种知识, 让你学习各种库, …

交叉报表crosstab隐藏列名显示_SAP软件 报表查询之 输出格式设置

SAP不仅是功能强大、逻辑严谨的ERP软件&#xff0c;还提供了强大的报表查询功能。SAP的ALV报表展示功能是SAP的一大特点&#xff0c;实现了类似于EXCEL的功能。使用好ALV报表功能可以方便用户从SAP中取到想要的数据&#xff0c;尤其是财务用户。大家在使用SAP报表时&#xff0c…