您的位置:首页 > 运维架构 > Tomcat

Centos5.5整合Apache和Tomcat 之一安装Apache

2012-09-25 18:03 489 查看
Apache系统环境如下:

Centos 5.5

httpd-2.4.3.tar.gz

apr-util-1.4.1.tar.gz

apr-1.4.6.tar.gz

gcc编译器

一、编译安装apache服务器

wget :http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.3.tar.gz

创建软件包得下载目录

mkdir -p /tmp/tools

cd /tmp/tools

wget :http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.3.tar.gz

[root@localhost tools]# ls

httpd-2.4.3.tar.gz

tar zxvf httpd-2.4.3.tar.gz -C /usr/local/ (解压并使用-C参数指定安装路径)

[root@localhost tools]# cd /usr/local/httpd-2.4.3/

[root@localhost httpd-2.4.3]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewirte

编译的是时候报错了

checking for APR... no

configure: error: APR not found. Please read the documentation找到不到apr。

下载apr wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.4.6.tar.gz

下载apr-util wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.4.1.tar.gz

查看tools目录下软件包 已下载完成

[root@localhost tools]# ll

-rw-r--r-- 1 root root 982243 2012-02-14 apr-1.4.6.tar.gz

-rw-r--r-- 1 root root 774770 2011-12-14 apr-util-1.4.1.tar.gz

-rw-r--r-- 1 root root 6137268 08-20 21:22 httpd-2.4.3.tar.gz

解压apr和apr-util

[root@localhost tools]# tar zxvf apr-util-1.4.1.tar.gz -C /usr/local/

[root@localhost tools]# tar zxvf apr-1.4.6.tar.gz -C /usr/local/

[root@localhost local]# ll

drwxr-sr-x 25 5000 10001 4096 2012-02-08 apr-1.4.6

drwxr-xr-x 19 501 games 4096 2011-12-08 apr-util-1.4.1

编译安装apr

[root@localhost local]# cd apr-1.4.6/

[root@localhost apr-1.4.6]# ./configure --prefix=/usr/local/apr

[root@localhost apr-1.4.6]# make && make install

安装apr-util

[root@localhost apr-util-1.4.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

[root@localhost apr-util-1.4.1]# make && make install

下面在次编译安装apache

[root@localhost httpd-2.4.3]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewirte

还是报错。。找不到apr-util (刚刚已经安装了)

checking for APR-util... no

configure: error: APR-util not found. Please read the documentation.

笔者试着指定apr-util得路径。。然后在试。。

[root@localhost httpd-2.4.3]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewirte --with-apr-util=/usr/local/apr-util

再一次报错。。郁闷。。缺少pcre的库

checking for pcre-config... false

configure: error: pcre-config for libpcre not found. PCRE is required and availa

安装pcre库

[root@localhost httpd-2.4.3]# yum install pcre-devel

在次编译apache,正常了

[root@localhost httpd-2.4.3]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewirte --with-apr-util=/usr/local/apr-util

[root@localhost httpd-2.4.3]#make && make install

安装完毕,查看目录文件

[root@localhost ~]# cd /usr/local/apache2/

[root@localhost apache2]# ls

bin cgi-bin error icons logs manual

build conf htdocs include man modules

[root@localhost apache2]#

启动apache服务

[root@localhost apache2]# /usr/local/apache2/bin/apachectl start

查看80端口

[root@localhost apache2]#

[root@localhost apache2]# lsof -i:80

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

httpd 18724 root 3u IPv6 95945 TCP *:http (LISTEN)

httpd 18725 daemon 3u IPv6 95945 TCP *:http (LISTEN)

httpd 18727 daemon 3u IPv6 95945 TCP *:http (LISTEN)

httpd 18729 daemon 3u IPv6 95945 TCP *:http (LISTEN)

到处apache安装完成。。(本来想用网页访问以下呢。。但是截图以后不能粘贴。。只能这样了。)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息