#将其安装在/usr/local/apr-uti目录下 并指明apr
httpd源代码安装
原创zhoulinjun 博主文章分类:linux ©著作权
©著作权归作者所有:来自51CTO博客作者zhoulinjun的原创作品,如需转载,请与作者联系,否则将追究法律责任
Redhat公司每几年出一张系统盘,相对于最新的其它软件来说,他推出得有些慢,所以,我们要用最新的软件,我们就得自己来安装。
下面,我来介绍Httpd 源代码安装
首先下载最新的httpd 源代码在http://httpd.apache.org/
将源代码拆包 tar -jxvf httpd-2.4.4.tar.bz2 -C /usr/local/src/
切换到/usr/local/src/httpd-2.4.4
查看安装手册
[root@zlj httpd-2.4.4]# vim INSTALL
根据安装手册来安装
1、执行
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd
--prefix指明安装地方
--sysconfdir指明安装的配置的地方
2、它将会提示下面的错误
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
说明缺少 APR文件(Apache Portable Runtime library),即Apache可移植运行时工具库
apr-1.4.6.tar.gz
tar -zxvf apr-1.4.6.tar.gz -C /usr/local/src/ #将其解压
[root@zlj apr-1.4.6]#./configure --prefix=/usr/local/apr #将其安装在/usr/local/apr目录下
[root@zlj apr-1.4.6]# make #编译
[root@zlj apr-1.4.6]# make install #安装
3、继续执行1,它将报
configure:
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
[root@zlj httpd-2.4.4]#
说明缺少 APR-util文件(Apache Portable Runtime Utility library),即Apache可移植运行时工具库
同理
[root@zlj pub]# tar -zxvf apr-util-1.5.1.tar.gz -C /usr/local/src/ #将其解压
[root@zlj apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#将其安装在/usr/local/apr-uti目录下 并指明apr
#将其安装在/usr/local/apr-uti目录下 并指明apr
[root@zlj apr-util-1.5.1]# make && make install
4、继续安装
[root@zlj httpd-2.4.4]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
它将提示
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
我们可以到 http://pcre.org/下载pcre( Perl兼容的正则表达式)
[root@zlj pub]# unzip -o pcre-8.32.zip #解压
[root@zlj pcre-8.32]# ./configure --prefix=/usr/local/pcre #将其安装在/usr/local/pcre目录下
[root@zlj pcre-8.32]# make && make install
5、继续安装
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre/ 指明apr 、apr-util 、prce
[root@zlj pcre-8.32]# make && make install #编译安装
[root@zlj init.d]# vim /etc/rc.d/init.d/httpd # 编写脚本,让其开机自动启用
#!/bin/sh
#chkconfig: 345 85 15
#description: httpd for 52lamp 20101016 21:54
ACMD="$1"
ARGV="$@"
case $ACMD in
start)
echo -n "httpd is running ..."
if [ -e /var/lock/subsys/httpd ];then
sleep 1
echo -e "\033[31m [faile]\033[0m"
else
/usr/local/apache/bin/httpd -k start
sleep 1
echo -e "\033[32m [ok]\033[0m"
touch /var/lock/subsys/httpd
fi;;
stop)
echo -n "httpd is stoping ..."
if [ -e /var/lock/subsys/httpd ];then
/usr/local/apache/bin/httpd -k stop
sleep 1
echo -e "\033[32m [ok]\033[0m"
rm -f /var/lock/subsys/httpd
else
sleep 1
echo -e "\033[31m [faile]\033[0m"
fi;;
restart|reload)
if [ -e /var/lock/subsys/httpd ];then
/usr/local/apache/bin/httpd -k restart
echo -n "httpd is stoping ..."
sleep 1
#!/bin/sh
#chkconfig: 345 85 15
#description: httpd for 52lamp 20101016 21:54
ACMD="$1"
ARGV="$@"
case $ACMD in
start)
echo -n "httpd is running ..."
if [ -e /var/lock/subsys/httpd ];then
sleep 1
echo -e "\033[31m [faile]\033[0m"
else
/usr/local/apache/bin/httpd -k start
sleep 1
echo -e "\033[32m [ok]\033[0m"
touch /var/lock/subsys/httpd
fi;;
stop)
echo -n "httpd is stoping ..."
if [ -e /var/lock/subsys/httpd ];then
/usr/local/apache/bin/httpd -k stop
sleep 1
echo -e "\033[32m [ok]\033[0m"
rm -f /var/lock/subsys/httpd
else
sleep 1
echo -e "\033[31m [faile]\033[0m"
fi;;
restart|reload)
if [ -e /var/lock/subsys/httpd ];then
/usr/local/apache/bin/httpd -k restart
echo -n "httpd is stoping ..."
sleep 1
echo -n "httpd is stoping ..."
sleep 1
echo -e "\033[32m [ok]\033[0m"
echo -n "httpd is running ..."
sleep 1
echo -e "\033[32m [ok]\033[0m"
else
echo -n "httpd is restart ..."
sleep 1
echo -e "\033[31m [faile]\033[0m"
fi;;
status)
sleep 1
if [ -e /var/lock/subsys/httpd ];then
sleep 1
echo "httpd is running ..."
else
sleep 1
echo "httpd is stop"
fi;;
*)
echo "Usage: /etc/init.d/httpd {start|stop|restart|condrestart|status}"
;;
esac
启用该进程
[root@zlj bin]# service httpd start
httpd is running ... [ok]
[root@zlj bin]#
6、测试
让其开机自动启用
[root@zlj bin]# chkconfig httpd on
[root@zlj bin]#
上一篇:PXE 网络自动安装
下一篇:配置yum
![](https://ucenter.51cto.com/images/noavatar_middle.gif)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
5-Docker实例-安装httpd
5-Docker实例-安装httpd
centos apache docker -
【小白源代码】小区物业管理系统
基于SpringBoot实现的小区物业管理系统是为物业管理打造的一款在线管理平台,它可以实时完成信息处理,对小区信息、住户等进行在线管理,使其系统化和规范化。
SpringBoot Vue 系统源码 课程设计 -
mysql源代码安装
mysql源代码安装
安装 mysql 源代码