apache编译安装

apache是什么:

    Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩充,将Perl/Python解释器编译到服务器中。同时Apache音译为阿帕奇,是北美印第安人的一个部落,叫阿帕奇族,在美国的西南部。也是一个基金会的名称、一种武装直升机等等。


今天尝试着安装apache,要求能访问,库文件和软链接,还有man帮助暂不阐述

前言:安装apache之前,检查gcc编译器是否安装

[root@localhost tmp]# rpm -qa |grep gcc
libgcc-4.4.7-17.el6.x86_64
gcc-4.4.7-17.el6.x86_64

我这里已经装过,没安装的话使用yum -y install gcc安装。

1、从apacha官网下载httpd包,http://apache.fayea.com/httpd  解压并cd到子目录:

[root@localhost ~]# tar -xf httpd-2.4.10.tar.bz2 
[root@localhost ~]# cd httpd-2.4.10
[root@localhost httpd-2.4.10]#

执行./configure,指定安装路径/usr/local/apache2

[root@localhost httpd-2.4.10]# ./configure --prefix=/usr/local/apache2
..
    
checking for APR... no
configure: error: APR not found.  Please read the documentation.
[root@localhost httpd-2.4.10]#

发现报错,提示没有找到APR的路径,从http://apache.fayea.com/apr/ 下载源码包apr,解压并cd到子目录

[root@localhost ~]# tar -xf apr-1.5.0.tar.bz2 
[root@localhost ~]# cd apr-1.5.0
[root@localhost apr-1.5.0]# ./configure --prefix=/usr/local/apr/
没有报错,继续安装
[root@localhost apr-1.5.0]# make && make install 
没有报错,安装成功!

2、再次安装httpd包,指定apr路径

[root@localhost httpd-2.4.10]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/
..
configure: 
checking for APR-util... no
configure: error: APR-util not found.  Please read the documentation.
[root@localhost httpd-2.4.10]#

发现缺少apr-util包,从http://apache.fayea.com/apr/下载apr-util包,解压后cd到子目录,执行./confgure 指定apr路径,顺便make和make install

[root@localhost apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/ && make && make install
..
/usr/bin/install -c -m 644 aprutil.exp /usr/local/apr-util//lib
/usr/bin/install -c -m 755 apu-config.out /usr/local/apr-util//bin/apu-1-config
[root@localhost apr-util-1.5.3]# 
成功安装,没有报错

3.再次尝试安装httpd包,提示缺少pcre包

[root@localhost httpd-2.4.10]# ./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ 
\--with-apr-util=/usr/local/apr-util/
..
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
[root@localhost httpd-2.4.10]#

从提示信息的官网下载pcre包 http://pcre.org,解压,cd到子目录,指定apr和apr-util安装路径    

[root@localhost pcre-8.38]# ./configure --prefix=/usr/local/pcre/ --with-apr=/usr/local/apr/ 
\--with-apr-util=/usr/local/apr-util/
..
checking for windows.h... no
configure: error: You need a C++ compiler for C++ support.

这里提示我没有安装C++编译器,yum安装

[root@localhost pcre-8.38]# yum -y install gcc-c++

再次安装pcre

[root@localhost pcre-8.38]# ./configure --prefix=/usr/local/pcre/ --with-apr=/usr/local/apr/ 
\--with-apr-util=/usr/local/apr-util/
[root@localhost pcre-8.38]# make && make install

4、最后安装httpd包,指定apr,apr-util,pcre 路径

[root@localhost httpd-2.4.10]# ./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ 
\--with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
..
[root@localhost httpd-2.4.10]# make && make install
mkdir /usr/local/apache2/manual
make[1]: Leaving directory `/root/httpd-2.4.10'
[root@localhost httpd-2.4.10]#

买有什么报错,启动服务

[root@localhost httpd-2.4.10]# /usr/local/apache2/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, 
\using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[root@localhost httpd-2.4.10]#

这里有个报错,提示主机名有问题,没什么大碍,不用管它,去网页检测一下

成功了。若访问不了,可能是防火墙的原因,iptables -F关闭它。

提示:在编译安装过程中,一定要cd 到解压之后的包目录,再执行./confgure 等操作。

001.png








原创文章,作者:M20-1--孔祥文,如若转载,请注明出处:http://www.178linux.com/39702

(0)
M20-1--孔祥文M20-1--孔祥文
上一篇 2016-08-24 21:22
下一篇 2016-08-24 21:22

相关推荐

  • Linux常用命令说明

    个人认为把操作练习打在博客上比较愚蠢,关于操作部分我将以练习题的形式展示,每周固定练习这些基础的题目 Linux常见命令练习 1.文本内容显示 1.1cat: (1)显示/root下adjtime文件内容 (2)把文件mm.txt的文件内容加上行号输入到textfile2文件中 (3)把文件mm.txt和textfile2的文件内容加上行号(空白行不加)之后…

    Linux干货 2016-10-29
  • 8月3日课堂练习及课后作业

    课堂练习 1、创建用户gentoo,附加组为bin和root,默认shell为/bin/csh,注释信息为“Gentoo Distribution” useradd -G bin,root -s /bin/csh -c "Gentoo Distribution" gentoo  2、创建下面的用户、组和组成员关系,名字为admi…

    Linux干货 2016-08-04
  • 分布式文件系统Mogilefs介绍与安装

    一、分布式文件系统简介: 什么是分布式存储:       分布式存储系统,是将数据分散存储在多台独立的设备上。传统的网络存储系统采用集中的存储服务器存放所有数据,存储服务器成为系统性能的瓶颈,也是可靠性和安全性的焦点,不能满足大规模存储应用的需要。分布式网络存储系统采用可扩展的系统结构,利用多台存储…

    Linux干货 2016-05-04
  • Linux http服务

                               Linux http服务   网络服务通信基础:   1、端口号就是进程标识,每个用户最多只能打开1024个进程。   2、MAC地址仅…

    系统运维 2016-11-18
  • N25第三周视频博客 find命令详解

    视频作业:find命令详解 大纲:         1、什么是find 2、find能实现什么功能 3、为什么要使用find 4、如何使用find 5、find各参数详解   1、什么是find      find是linux 命令,它将档案系统内符合 expression(表达…

    Linux干货 2016-12-15
  • PXE自动化安装系统服务

    PXE PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)或M…

    Linux干货 2016-11-07