首页 > Web开发 > 详细

linux 源码安装apache2.4并添加服务

时间:2015-07-06 19:59:41      阅读:274      评论:0      收藏:0      [点我收藏+]
源码安装apache,路径 /usr/local/httpd24

1.安装apr
yum -y install epel-release 
wget -c http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz tar xf apr-1.5.2.tar.gz cd apr-1.5.2 
./configure --prefix=/usr/local/apr;echo $? make && make install;echo $? 
cd ..

2.安装apr-util
wget -c http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz tar xf apr-util-1.5.2.tar.gz 
cd apr-util-1.5.2 
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr;echo $? 
make && make install;echo $?

3.安装httpd2.4.12
yum install pcre-devel openssl-devel 
wget -c http://www.apache.org/dist/httpd/httpd-2.4.12.tar.gz 
tar xf httpd-2.4.12.tar.gz
cd httpd-2.4.12 
./configure --prefix=/usr/local/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=event;echo $? 
make && make install;echo $?

4.测试
 /usr/local/apache24/bin/apachectl start
 netstat -utl |grep http
 出现 0 *:http                      *:*                         LISTEN
 浏览器访问centos机器IP,出现It works!

5.添加到系统服务实现开机启动:
cp /usr/local/httpd24/bin/apachectl /etc/init.d/httpd
vim /etc/init.d/httpd
在文件开头加入下面几行:
#!/bin/sh
# chkconfig: 35 85 15
# description: Apache  server. 
chmod +x /etc/init.d/httpd
/sbin/chkconfig --add httpd
/sbin/chkconfig --list httpd
ln -s /sbin/chkconfig /usr/bin/chkconfig
ln -s /sbin/service /usr/bin/service


linux 源码安装apache2.4并添加服务

原文:http://xiochen.blog.51cto.com/2468288/1671388

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!