Apache2.4安装指南及一键安装脚本

简介:  apache2.4安装指南.pdf    install-apache.sh.zip    Apache2.4安装指南 一见 2012/12/26 目录 1.

common.gif apache2.4安装指南.pdf   zip.gif install-apache.sh.zip   

Apache2.4安装指南

一见 2012/12/26

目录

1. 前言 1

2. 依赖库 1

3. Apache2.4下载网址 1

4. 安装步骤 2

4.1. 安装Pcre 2

4.2. 安装Apache 2

5. 修改配置 2

6. 1Apache官方中文文档主页 3

7. 2:一键脚本 3

7.1. 一键脚本前提 3

7.2. 一键脚本全文 3

1. 前言

本文档试图以最简单方式阐明Apache2.4版本的安装。Apache采用的是automake编译方式,包括它所依赖的库,正因为这种依赖,使用得编译安装稍变复杂。

如果喜欢英文阅读,可直接查看官方的指南:http://httpd.apache.org/docs/2.4/install.html,这里有详细的说明。

2. 依赖库

Apache依赖aprapr-utilpcre,下载网址为:

1) AprApr-utilhttp://apr.apache.org/截止2012/12/26,版本分别为:apr-1.4.6.tar.gzapr-util-1.5.1.tar.gz

2) Pcrehttp://pcre.org/(实际下载网址是http://sourceforge.net/projects/pcre/files/pcre/ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/,建议从sourceforge.net处下载,后一个经常抽风)。截止2012/12/26,版本为:pcre-8.32.tar.gz

3. Apache2.4下载网址

http://httpd.apache.org/download.cgi#apache24

Apache2.4的源代码包为:httpd-2.4.3.tar.gz(注意最后一位版本号3可能不同)。

4. 安装步骤

AprApr-util不用特别去编译和安装,随Apache一起完成,见下面的“安装Apache”一节。

4.1. 安装Pcre

在安装Apache之前,需要安装好Pcre,安装过程完全遵循automake方式,步骤依次如下:

1) ./configure --prefix=/usr/local/pcre(注:将Pcre安装到/usr/local/pcre目录下)

2) make

3) make install

4.2. 安装Apache

1) httpd-2.4.3.tar.gz上传到编译目录下(这里假设编译目录为/tmp/X,也可以为其它任意目录)

2) 进入/tmp/X目录,解压源码包:tar xzf httpd-2.4.3.tar.gz,解压后会在/tmp/X产生一个httpd-2.4.3目录,在httpd-2.4.3目录下还会有个srclib子目录

3) AprApr-util源码包上传到srclib子目录

4) 进入srclib子目录,将AprApr-util源码包解压,如:tar xzf apr-1.4.6.tar.gz; tar xzf apr-util-1.5.1.tar.gz,注意解压后产生的AprApr-util目录是带版本号的

5) 重命名AprApr-util目录,去掉后面的版本号,如:mv apr-1.4.6 apr; mv apr-util-1.5.1 apr-util(这个在官方的指南里有说明的)

6) 进入/tmp/X/httpd-2.4.3目录,按照automake方式来编译Apache(注意需要指定Pcre):

./configure --prefix=/usr/local/httpd --with-pcre=/usr/local/pcre (注:/usr/local/httpdApache的安装目录,可根据需要修改)。

7) 接下来执行make编译源代码

8) 编译成功后,执行make install即可将Apache安装到/usr/local/httpd 目录下

9) 至此,大功告成!!!

5. 修改配置

如将Apache安装在/usr/local/httpd目录下,则进入/usr/local/httpd/conf目录,对http.conf按照需要进行修改,常修改的行有:

1) Listen 80

2) DocumentRoot "/usr/local/httpd/htdocs"

6. 1Apache官方中文文档主页

http://httpd.apache.org/docs/2.4/

7. 2:一键脚本

7.1. 一键脚本前提

1) 使用root用户操作;

2) AprApr-utilPcreApache安装包都放在同一个目录下,如:

~/app # ls

apr-1.4.6.tar.gz  apr-util-1.5.1.tar.gz  httpd-2.4.3.tar.gz  pcre-8.32.tar.gz

3) 目录下不要放其它后缀为.tar.gz的文件

7.2. 一键脚本全文

#!/bin/sh

# Writed by yijian on 2012/12/26

# A key to install apache

# Download

#which wget

#if test $? -ne; then

# echo "wget NOT FOUND"

#else

# wget "http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz"

# wget "http://mirror.bjtu.edu.cn/apache/apr/apr-util-1.5.1.tar.gz"

# wget "http://labs.mop.com/apache-mirror/httpd/httpd-2.4.3.tar.gz"

# wget "http://nchc.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz"

#fi

# Get names

apr_tar_gz=`ls |grep -e "apr-[0-9]*\.[0-9]*\.[0-9]*\.tar\.gz"`

apr_util_tar_gz=`ls |grep -e "apr-util-[0-9]*\.[0-9]*\.[0-9]*\.tar\.gz"`

apr=`basename $apr_tar_gz .tar.gz`

apr_util=`basename $apr_util_tar_gz .tar.gz`

httpd=`basename httpd-*.tar.gz .tar.gz`

pcre=`basename pcre-*.tar.gz .tar.gz`

echo $apr

echo $apr_util

echo $pcre

echo $httpd

# unzip files

tar xzf $apr.tar.gz

tar xzf $apr_util.tar.gz

tar xzf $pcre.tar.gz

tar xzf $httpd.tar.gz

# Depends

mv $apr $httpd/srclib/apr

if test $? -ne 0; then

exit 1

fi

mv $apr_util $httpd/srclib/apr-util

if test $? -ne 0; then

exit 1

fi

# Compile pcre

cd $pcre

./configure --prefix=/usr/local/pcre

make

if test $? -ne 0; then

exit 1

fi

make install

if test $? -ne 0; then

exit 1

fi

# Compile apache

cd ../$httpd

./configure --prefix=/usr/local/httpd --with-pcre=/usr/local/pcre

if test $? -ne 0; then

exit 1

fi

make

if test $? -ne 0; then

exit 1

fi

make install

if test $? -ne 0; then

exit 1

fi

# Congratulation

echo "finished"

cd /usr/local/httpd/conf

相关文章
|
6月前
|
Kubernetes 调度 Docker
一键安装k8s脚本
一键安装k8s脚本
167 0
|
Linux
Linux环境下安装和配置OpenOffice及常见问题解决
本文主要讲解在Linux环境下,如何安装OpenOfice环境,及配置开机自启动
4549 0
Linux环境下安装和配置OpenOffice及常见问题解决
|
9月前
|
缓存 Apache
执行命令安装Apache及其扩展包时报错
执行命令安装Apache及其扩展包时报错
197 1
|
网络协议 安全 Unix
源代码配置安装Apache
Apache(音译为阿帕奇)是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩充,将Perl/Python等解释器编译到服务器中。
源代码配置安装Apache
|
Linux PHP
easyswoole一键安装脚本,宝塔安装错误
需要注意的是,这只是几句很简单的命令,并且在文档中都有出现。只是文档有比较多的场景描述,可能导致有些新人没有细心观看到。
97 0
|
Ubuntu Apache
阿里云Ubuntu系统安装Apache服务器
阿里云Ubuntu系统安装Apache服务器
336 0
阿里云Ubuntu系统安装Apache服务器
|
域名解析 应用服务中间件 编译器
Apache 源码安装详细教程
Apache 源码安装详细教程
272 0
Apache 源码安装详细教程
|
Linux Shell Apache
Apache Superset1.2.0教程(四)—— CentOS环境安装
前文中,我们已经在windows环境进行了superset的安装,也对图表功能进行了展示。但是在平时使用以及生产环境中,还是需要在centos环境下进行操作。 本文将带大家详解在centos7环境进行apache superset安装的全过程。 注意:superset 1.2.0需要python 3.7.9或以上的版本,不然可能会有各种坑。
456 0
Apache Superset1.2.0教程(四)—— CentOS环境安装
|
网络协议 Java Linux
7.17 Linux脚本程序包及安装方法详解(以webmin为例)
脚本程序并不多见,所以在软件包分类中并没有把它列为一类。它更加类似于 Windows 下的程序安装,有一个可执行的安装程序,只要运行安装程序,然后进行简单的功能定制选择(比如指定安装目录等),就可以安装成功,只不过是在字符界面完成的。
240 0
7.17 Linux脚本程序包及安装方法详解(以webmin为例)
|
Ubuntu 应用服务中间件
ubuntu 下载安装tomcat简单配置(傻瓜式教程)
ubuntu 下载安装tomcat简单配置(傻瓜式教程)
211 0
ubuntu 下载安装tomcat简单配置(傻瓜式教程)