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

【Apache学习】编译安装httpd2.4 含傻瓜版自动安装脚本

时间:2015-08-06 18:44:04      阅读:307      评论:0      收藏:0      [点我收藏+]

标签:apache   installation   httpd2.4   

学习编译安装httpd2.4,考虑到要和httpd2.2共存,所以安装httpd2.4时需要指定安装目录,考虑包之间的依赖关系。


apr-1.5.0.tar.bz2
apr-util-1.5.3.tar.bz2(需要apr-1.5.0)
httpd-2.4.9.tar.bz2 (需要pcre-devel、openssl-devel)

目录结构如下

[root@adelababy soft]# pwd
/root/soft
[root@adelababy soft]# tree
.
├── apr-1.5.0.tar.bz2
├── apr-util-1.5.3.tar.bz2
├── httpd-2.4.9.tar.bz2
└── httpd24_install.sh

0 directories, 4 files

httpd24_install.sh

#!/bin/bash
DATE1=`date +%s%N|cut -c1-13`
yum install -y gcc

cd /root/soft
tar jxf  apr-1.5.0.tar.bz2
tar jxf  apr-util-1.5.3.tar.bz2
tar jxf  httpd-2.4.9.tar.bz2
cd apr-1.5.0
./configure --prefix=/usr/local/apr
make && make install
cd ..

cd apr-util-1.5.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
cd ..

yum install -y pcre-devel
yum install -y openssl-devel

cd httpd-2.4.9
## --sysconfdir=/etc/httpd24  指定配置文件路径
## --enable-so  启动模块动态装卸载
## --enable-ssl 编译ssl模块 需要预先安装openssl-devel
## --enable-cgi 支持cgi机制(能够让静态web服务器能够解析动态请求的一个协议)
## --enable-rewrite  支持url重写
## --with-zlib  支持数据包压缩
## --with-pcre  支持正则表达式 需要预先安装pcre-devel
## --with-apr=/usr/local/apr  指明依赖的apr所在目录
## --with-apr-util=/usr/local/apr-util/  指明依赖的apr-util所在的目录
## --enable-modules=most      启用的模块
## --enable-mpms-shared=all   以共享方式编译的模块
## --with-mpm=prefork         指明httpd的工作方式为prefork
./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=prefork
make && make install

DATE2=`date +%s%N|cut -c1-13`
echo "Running time:: $((${DATE2}-${DATE1}))"

echo "Done!"

Running time:: 209274
Done!

[root@adelababy soft]# ls /usr/local/apr
bin  build-1  include  lib
[root@adelababy soft]# ls /usr/local/apr-util/
bin  include  lib
[root@adelababy soft]# ls /usr/local/httpd24/
bin  build  cgi-bin  error  htdocs  icons  include  logs  man  manual  modules

启动httpd2.4

将httpd2.2关闭
[root@adelababy bin]# service httpd status
httpd (pid  30807) is running...
[root@adelababy bin]# service httpd stop
Stopping httpd:
                                                           [  OK  ]

进入httpd2.4的安装目录,启动进程,查看80端口是否启动了。

[root@adelababy bin]# cd /usr/local/httpd24/bin/
[root@adelababy bin]# ls
ab         checkgid   envvars-std   htdbm     httpd       rotatelogs
apachectl  dbmmanage  fcgistarter   htdigest  httxt2dbm
apxs       envvars    htcacheclean  htpasswd  logresolve
[root@adelababy bin]# ./apachectl start
[root@adelababy bin]#

LISTEN     0      128                                                               
[root@adelababy bin]# ls
ab  apachectl  apxs  checkgid  dbmmanage  envvars  envvars-std  fcgistarter  htcacheclean  htdbm  htdigest  htpasswd  httpd  httxt2dbm  logresolve  rotatelogs
[root@adelababy bin]# ./apachectl start
[root@adelababy bin]# ss -ntlp
State      Recv-Q Send-Q                                                    Local Address:Port                                                      Peer Address:Port
LISTEN     0      128                                                                  :::22                                                                  :::*      users:(("sshd",1276,4))
LISTEN     0      128                                                                   *:22                                                                   *:*      users:(("sshd",1276,3))
LISTEN     0      128                                                           127.0.0.1:631                                                                  *:*      users:(("cupsd",1117,7))
LISTEN     0      128                                                                 ::1:631                                                                 :::*      users:(("cupsd",1117,6))
LISTEN     0      100                                                                 ::1:25                                                                  :::*      users:(("master",1384,13))
LISTEN     0      100                                                           127.0.0.1:25                                                                   *:*      users:(("master",1384,12))
LISTEN     0      128                                                                  :::47422                                                               :::*      users:(("rpc.statd",1041,11))
LISTEN     0      128                                                                   *:52751                                                                *:*      users:(("rpc.statd",1041,9))
LISTEN     0      128                                                                  :::111                                                                 :::*      users:(("rpcbind",1021,11))
LISTEN     0      128                                                                   *:111                                                                  *:*      users:(("rpcbind",1021,8))
LISTEN     0      128                                                                  :::80                                                                  :::*      users:(("httpd",61535,4),("httpd",61536,4),("httpd",61537,4),("httpd",61538,4),("httpd",61539,4),("httpd",61540,4))
[root@adelababy bin]#


Done!



本文出自 “Adela” 博客,谢绝转载!

【Apache学习】编译安装httpd2.4 含傻瓜版自动安装脚本

标签:apache   installation   httpd2.4   

原文地址:http://adelazhu.blog.51cto.com/9455045/1682264

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