学习编译安装httpd2.4,考虑到要和httpd2.2共存,所以安装httpd2.4时需要指定安装目录,考虑包之间的依赖关系。
1
2
3
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)
目录结构如下
1
2
3
4
5
6
7
8
9
10
[iyunv@adelababy soft]# pwd
/root/soft
[iyunv@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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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!
1
2
3
4
5
6
[iyunv@adelababy soft]# ls /usr/local/apr
bin build-1 include lib
[iyunv@adelababy soft]# ls /usr/local/apr-util/
bin include lib
[iyunv@adelababy soft]# ls /usr/local/httpd24/
bin build cgi-bin error htdocs icons include logs man manual modules
启动httpd2.4
1
2
3
4
5
6
将httpd2.2关闭
[iyunv@adelababy bin]# service httpd status
httpd (pid 30807) is running...
[iyunv@adelababy bin]# service httpd stop
Stopping httpd:
[ OK ]
进入httpd2.4的安装目录,启动进程,查看80端口是否启动了。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[iyunv@adelababy bin]# cd /usr/local/httpd24/bin/
[iyunv@adelababy bin]# ls
ab checkgid envvars-std htdbm httpd rotatelogs
apachectl dbmmanage fcgistarter htdigest httxt2dbm
apxs envvars htcacheclean htpasswd logresolve
[iyunv@adelababy bin]# ./apachectl start
[iyunv@adelababy bin]#
LISTEN 0 128
[iyunv@adelababy bin]# ls
ab apachectl apxs checkgid dbmmanage envvars envvars-std fcgistarter htcacheclean htdbm htdigest htpasswd httpd httxt2dbm logresolve rotatelogs
[iyunv@adelababy bin]# ./apachectl start
[iyunv@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))
[iyunv@adelababy bin]#
Done!
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com