Apache简介
Apache软件下载
Apache的相关软件包下载地址http://apr.apache.org/projects.html
1. Apache HTTP Server
截止目前为止,Apache HTTP Server 目前最新的版本是 Apache httpd 2.4.6 Released, 下载地址:
2. APR and APR-Util包
截止目前为止,APR and APR-Util的最新版本如下,下载地址:
3. PCRE包
截止目前为止,香港服务器,PCRE最新的包为8.33,下载地址如下
https://sourceforge.net/projects/pcre/files/pcre/
可以下载了相关安装包,上传到/root/kerry这个临时目录。也可以直接通过wget下载
Apache安装要求
下面是官方文档的要求,必须安装APR、APR-Util、PCRE,gcc-c++等包,文档URL地址
Requirements
The following requirements exist for building Apache httpd:
APR and APR-Util
Perl-Compatible Regular Expressions Library (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
Accurate time keeping
Perl 5 [OPTIONAL]
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
新建目录/usr/local/apr,香港服务器,用作安装目录:
[root@getlnx05 apr-1.4.8]# mkdir /usr/local/apr
[root@getlnx05 apr-1.4.8]# ./configure –prefix=/usr/local/apr
[root@getlnx05 apr-1.4.8]# make
[root@getlnx05 apr-1.4.8]# make install
安装完成后,可以验证一下
[ 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
[root@getlnx05 apr-util-1.5.2]# ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr/bin/apr-1-config
[root@getlnx05 apr-util-1.5.2]# make
[root@getlnx05 apr-util-1.5.2]# make install
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
[root@getlnx05 pcre-8.33]# make
[root@getlnx05 pcre-8.33]# make install
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
用浏览器访问时提示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
一般出现这个错误是因为没有安装包gcc-c++,可以通过如下命令检查,
[root@getlnx05 pcre-8.33]# yum list gcc-c++
Loaded plugins: product-id, security, subscription-manager
Updating Red Hat repositories.
Available Packages
爬上那座山,听最圣洁的经。