Red Hat Enterprise Linux Server release 5.5 (Tikanga) 配置Apache httpd-2.4.4
本文是在参见博友spinsoft的文章成功配置后整理。链接:http://www.iyunv.com/spinsoft/archive/2012/09/07/2675078.html感谢博友spinsoft的文章,我们环境不同,过程略有不同。
红色文字为重点内容,蓝色文字为引用博友spinsoft内容。
====================================
环境:
# cat /etc/issue
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Kernel \r on an \m
httpd-2.4.4.tar.gz
下载地址:http://www.apache.org/
====================================
解压httpd-2.4.4.tar.gz,编译
# tar jxvf httpd-2.4.4.tar.bz2
# cd httpd-2.4.4
# ls
# ./configure--prefix=/usr/local/apache--enable-so//配置apache路径 ,后面跟 --enable-so 参数表示让apache核心装载DSO
Error:
checking for APR... no
configure: error: APR not found.Please read the documentation.
去Apache官网下载apr-1.4.6.tar.gz,解压编译安装。
# tar zxf apr-1.4.6.tar.gz
# cd apr-1.4.6
# ./configure --prefix=/usr/local/apr
# make
# make install
继续编译Apache
# ./configure--prefix=/usr/local/apache--enable-so
Error:
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... Invalid configuration ` ': machine ` ' not recognized
configure: error: /bin/sh build/config.sub failed
上百度找到解决方法,虽然是解决问题了,但是原理我还不是很理解。
# yum list | grep libtool*
libtool.i386 1.5.22-7.el5_4 installed
libtool-ltdl.i386 1.5.22-7.el5_4 base
libtool-ltdl-devel.i386 1.5.22-7.el5_4 base
# yum install libtool-ltdl.i386 libtool-ltdl-devel.i386
复制config.sub和config.guess到当前要configure目录下,比如安装Apache,进入解压后的文件夹(httpd-2.4.4)进行如下操作:
cp /usr/share/libtool/config.sub ./
cp /usr/share/libtool/config.guess ./
然后添加configure参数:./configure --enable-shared --enable-static
继续编译Apache
# ./configure --prefix=/usr/local/apache --enable-so --enable-shared --enable-static
Error:
checking for APR-util... no
configure: error: APR-util not found.Please read the documentation.
去Apache官网下载apr-util-1.5.2.tar.gz,解压编译安装。
# tar zxf apr-util-1.5.2.tar.gz
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
# make && make install
编译通过,继续编译Apache
这时候要注意修改参数
# ./configure --prefix=/usr/local/apache --enable-so --enable-shared --enable-static --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/
# make && make install
Apache编译安装完毕
停止&启动Apache
# pwd
/usr/local/apache/bin
# apachectl stop
# apachectl start
查看Apache端口
# netstat -an | grep :80
tcp 0 0 :::80 :::* LISTEN
# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
httpd 22569 root 4uIPv697220 TCP *:http (LISTEN)
httpd 22570 apache 4uIPv697220 TCP *:http (LISTEN)
httpd 22571 apache 4uIPv697220 TCP *:http (LISTEN)
httpd 22572 apache 4uIPv697220 TCP *:http (LISTEN)
httpd 22573 apache 4uIPv697220 TCP *:http (LISTEN)
httpd 22574 apache 4uIPv697220 TCP *:http (LISTEN)
httpd 22575 apache 4uIPv697220 TCP *:http (LISTEN)
httpd 22576 apache 4uIPv697220 TCP *:http (LISTEN)
httpd 22577 apache 4uIPv697220 TCP *:http (LISTEN)
查看Apache服务启动情况
# ps -aux | grep httpd
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 225690.03.7246369460 ? Ss 15:20 0:00 /usr/sbin/httpd -k start
apache 225700.01.8246364800 ? S 15:20 0:00 /usr/sbin/httpd -k start
apache 225710.01.8246364800 ? S 15:20 0:00 /usr/sbin/httpd -k start
apache 225720.01.8246364800 ? S 15:20 0:00/usr/sbin/httpd -k start
apache 225730.01.8246364800 ? S 15:20 0:00 /usr/sbin/httpd -k start
apache 225740.01.8246364800 ? S 15:20 0:00 /usr/sbin/httpd -k start
apache 225750.01.8246364800 ? S 15:20 0:00 /usr/sbin/httpd -k start
apache 225760.01.8246364800 ? S 15:20 0:00 /usr/sbin/httpd -k start
apache 225770.01.8246364800 ? S 15:20 0:00 /usr/sbin/httpd -k start
root 227350.00.2 3920 696 pts/3 S+ 15:25 0:00 grep httpd
访问一下apache默认页是否能打开,http://ip:80/index.html
我虚拟机和宿主机使用的是桥接,也能成功从宿主机访问Apache默认页面和自己创建的页面。
创建访问页面
# pwd
/var/www/html
# ll
total 8
-rwxr--r-- 1 root root 5 Apr7 15:34 index.html
-rwxr--r-- 1 root root 5 Apr7 15:34 luke.html
End
页:
[1]