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,一经查实,立即删除!

相关文章

[网摘].NET 程序员十种必备工具-概述

从 MSDN 中看到这篇文章&#xff0c;觉得不错转了过来&#xff0c;对于我这样的.NET新手来说每个工具都是提高效率的好开始。将这十款软件的介绍重新格式化一下&#xff0c;方便以后查阅。以 “.NET 程序员十种必备工具”开头的10篇文章都是从这篇文章中分离出来&#xff0c;每…

完整asp.net图形验证码程序

1、测试页面&#xff1a;Default.aspx <% Page Language"C#" AutoEventWireup"true" CodeFile"Default.aspx.cs" Inherits"_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" &q…

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

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

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

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

Centos编译安装Apache 2.4.6笔记 配置

转载链接&#xff1a;http://www.onepx.com/centos-apache-246.html 之前服务器 Apache 版本一直是 2.2.x&#xff0c;鉴于 Centos 更新软件的惰性&#xff0c;我看直到 2014 年结束&#xff0c;apache 2.4 都不一定会出现在 Centos 中&#xff0c;我是不打算等了&#xff0c;…

[转] 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 包…

Installation of Apache HTTPD

转载链接&#xff1a;http://www.linuxfromscratch.org/blfs/view/svn/server/apache.html Installation of Apache-2.4.7 HTTPD For security reasons, running the server as an unprivileged user and group is strongly encouraged. Create the following group and user…

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

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

教师节,你记忆中老师说过印象最深的是什么话?(抽奖)

我记忆中老师说过印象最深的话小学老师&#xff1a;1、小学语文老师李老师说&#xff0c;以后你们可能带个手机就可以支付了~不需要带现金。&#xff08;在杭州确实实现了&#xff0c;用支付宝即可&#xff09; 2、小学数学老师李老师说&#xff1a;好好读书的目的是啥&#xf…

Spark List组件滚动条加事件使datalist数据发生变化

<?xml version"1.0" encoding"utf-8"?><!-- http://blog.flexexamples.com/2009/05/31/detecting-when-the-vertical-scroll-bar-is-scrolled-on-a-spark-list-control-in-flex-4/ --><s:Application name"Spark_List_scroller_vert…

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

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

PHP5加载|安装外部C动态库

[1] cd php-5.3.9/ext[2] ./ext_skel --extnamencdocxml[3] cd ncdocxml[4] nano -w config.m4############删除 3 个 dnldnl PHP_ARG_WITH(my_module, for my_module support,dnl Make sure that the comment is aligned:dnl [ --with-my_module Include my_module support])或…

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

背景凹凸曼是个小程序开发者&#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;前段时间&#…

Mysql InnoDB Plugin安装 install

转载链接&#xff1a;http://www.orczhou.com/index.php/2010/03/innodb-plugin-setup/ InnoDB Plugin较之Built-in版本新增了很多特性&#xff1a;包括快速DDL、压缩存储等&#xff0c;而且引入了全新的文件格式Barracuda。众多测试也表明&#xff0c;Plugin在很多方面优于Bu…

Hibernate的数据过滤查询

数据过滤并不是一种常规的数据查询方法&#xff0c;而是一种整体的筛选方法。数据过滤也可对数据进行筛选&#xff0c;因此&#xff0c;将其放在Hibernate的数据查询框架中介绍。 如果一旦启用了数据过滤器&#xff0c;则不管数据查询&#xff0c;还是数据加载&#xff0c;该过…