码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-07-06 20:00:34      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:添加服务   apache   

源码安装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并添加服务

标签:添加服务   apache   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!