Linux系统安装Apache 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:安装包gccgcc-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:安装包APRAPR-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]#

转载于:https://www.cnblogs.com/hyl8218/p/7543404.html

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

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

相关文章

lnmp化境开启pathinfo,支持tp5.0等访问

一、 开启pathinfo   #注释 下面这一行 #include enable-php.conf #载入新的配置文件 include enable-php-pathinfo.conf #添加如下location / {if (!-e $request_filename){rewrite ^/(.*)$ /index.php/$1 last;break;}}location ~ /index.php {fastcgi_pass 127.0.0.1:…

openfire(一):使用idea编译openfire4.2.3源码

最近公司项目要使用openfire&#xff0c;并对源码做一些修改&#xff0c;使用的openfire版本为官网目前最新版本4.2.3&#xff0c;网上资料较少&#xff0c;踩了很多坑&#xff0c;特此记录。 1.下载源码 http://www.igniterealtime.org/downloads/source.jsp 2.使用idea导入源…

[BZOJ] 1688: [Usaco2005 Open]Disease Manangement 疾病管理

1688: [Usaco2005 Open]Disease Manangement 疾病管理 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 727 Solved: 468[Submit][Status][Discuss]Description Alas! A set of D (1 < D < 15) diseases (numbered 1..D) is running through the farm. Farmer John woul…

Image-to-Image Translation with conditional Adversarial Networks ---- Pix-2-Pix

任务场景 Photos to semantic segmentationCityscapes labels to photosColorizationFacades labels to photoDay to nightThe edges to photoAnd so on.在生成器模型中&#xff0c;条件变量y实际上是作为一个额外的输入层&#xff08;additional input layer&#xff09;&…

5分钟从零构建第一个 Apache Flink 应用

为什么80%的码农都做不了架构师&#xff1f;>>> 在本文中&#xff0c;我们将从零开始&#xff0c;教您如何构建第一个Apache Flink &#xff08;以下简称Flink&#xff09;应用程序。 开发环境准备 Flink 可以运行在 Linux, Max OS X, 或者是 Windows 上。为了开发…

Android6.0------权限申请RxPermissions

前面写了Android6.0权限介绍和权限单个&#xff0c;多个申请&#xff0c;用的是纯Java代码&#xff0c;本文主要说的是借助第三方库来实现权限申请。 借助第三方库 RxPermissions来申请6.0权限。 RxPermissions库地址&#xff1a;https://github.com/tbruyelle/RxPermissions …

博客作业04--树

1.学习总结(2分) 1.1树结构思维导图 1.2 树结构学习体会 树这一章节比较复杂&#xff0c;知识点繁多&#xff0c;结合了递归的知识所以代码阅读起来会有障碍&#xff0c;难以理解&#xff0c;所以学起来比较吃力&#xff0c;而且很多经典的算法理解的不是很透彻解决pta上的问题…

[DP/单调队列]BZOJ 2059 [Usaco2010 Nov]Buying Feed 购买饲料

首先我想吐槽的是题目并没有表明数据范围。。。 这个题目 DP方程并不难表示。 dp[i][j]表示前i个地点携带了j个货物的最小花费 dp[i][j] dp[i-1][k] (j-k) * cost j*j*(leng[i]-leng[i-1]) 如果你这样直接提交上去&#xff0c;恭喜你超时&#xff01;&#xff01;&#xff0…

039_MySQL_多表查询

#创建部门 CREATE TABLE IF NOT EXISTS dept (did int not null auto_increment PRIMARY KEY,dname VARCHAR(50) not null COMMENT 部门名称 )ENGINEINNODB DEFAULT charset utf8;#添加部门数据 INSERT INTO dept VALUES (1, 教学部); INSERT INTO dept VALUES (2, 销售部); IN…

4.navicat11激活教程,亲测可用哦!

原文地址&#xff1a;http://blog.csdn.net/sanbingyutuoniao123/article/details/52589678Navicat是一款数据库管理工具, 用于简化, 开发和管理MySQL, SQL Server, SQLite, Oracle 和 PostgreSQL 的数据库&#xff1b;Navicat数据模型工具以图形化方式创建关联式数据库&#x…

想要去阿里面试?你必须得跨过 JVM 这道坎!

概述 很多人想要到阿里巴巴、美团、京东等互联网大公司去面试&#xff0c;但是现在互联网大厂面试一般都必定会考核JVM相关的知识积累和实践经验&#xff0c;毕竟线上系统写好代码部署之后&#xff0c;每个工程师都必须关注JVM相关的东西&#xff0c;比如OOM、GC等问题. 所以一…

医学知识图谱一

大纲 知识自动提取技术 医学知识融合 医学知识推理 转载于:https://www.cnblogs.com/quietwalk/p/9000950.html

在一个div里,列表样式图片进行float,实现水平排序

<div class"xiangce"><ul> <li><a href"#"><img src"images/pic4.gif" alt"">产品名称</a></li><li><a href"#"><img src"images/pic4.gif" alt"…

The listener supports no services

$ lsnrctl start 报错提示: The listener supports no services The command completed successfully 如图所示&#xff1a; 这样启动后远程连接会报错&#xff1a; oracle ORA-12514:TNS:listener does not currently know of service requested in connect descriptor 问题原…

SEO【总结】by 2019年5月

2019独角兽企业重金招聘Python工程师标准>>> 关键点&#xff1a; 1、代码 1.1、seo前端代码&#xff1a;基于Html代码的SEOherf&#xff1a;https://my.oschina.net/u/2862573/blog/3030664 注意的要点&#xff1a; h1&#xff0c;h2的内容很关键 网页的压缩、静态化…

Oracle数据库 查看表是否是 索引组织表的方法

1. 最近在工作过程中发现 一个表插入很慢 以为是索引组织表, 所以一直有点纠结 但是发现 产品里面是没有IOT的 于是找了下公司的OCP 问了下 如何查看 就是 user_tables 视图里面的一个字段. 见图: 转载于:https://www.cnblogs.com/jinanxiaolaohu/p/9018037.html

Windows server 2016 搭建RDS服务

计算机的更新换代太快&#xff0c;新购置的计算机没几年便觉得运行速度越来越慢&#xff0c;尤其是在运行一些比较大的应用程序是&#xff0c;用户总是抱怨运行速度太慢或者总是死机等问题。如果要更换新的计算机&#xff0c;又得不到领导的批准&#xff0c;因此对于企业来说&a…

springboot2.0 多数据源整合问题 At least one JPA metamodel must be present!   at

2019独角兽企业重金招聘Python工程师标准>>> 数据源代码&#xff1a; 第一个读取配置文件代码&#xff1a; package com.datasource;import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionFactoryBean; import org.mybatis.sp…

docker实战系列之搭建rabbitmq

1.搜索镜像【注&#xff1a;因为我这里采用的是阿里云镜像加速器,所以我直接在阿里云中搜索相关镜像路径】,点击"详情"查看公网拉取路径 2.拉取镜像 docker pull registry.cn-hangzhou.aliyuncs.com/jc/rabbitmq-3 3.查看拉取的镜像 docker images 4.创建并运行容器【…

计算机基础知识--编码知识

编码回顾 编码转换 Python的bytes类型 编码回顾 在备编码相关的课件时&#xff0c;在知乎上看到一段关于Python编码的回答 这哥们的这段话说的太对了&#xff0c;搞Python不把编码彻底搞明白&#xff0c;总有一天它会猝不及防坑你一把。 不过感觉这哥们的答案并没把编码问题写明…