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 :
创建软件包得下载目录
mkdir -p /tmp/tools
cd /tmp/tools
wget :
[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
下载apr-util wget
查看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安装完成。
CentOS 5.5整合Apache和Tomcat
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.heiqu.com/01629fa1d3b1504850add6789181f477.html