[笔记] centos6.6编译安装httpd2.4.10

系统安装包是CentOS-6.6-x86_64-minimal.iso

查看一下uname信息

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]#yum install -y vim wget lrzsz

需要的安装包httpd-2.4.10.tar.bz2、apr-1.5.1.tar.bz2(Apache portable Run-time libraries)、apr-util-1.5.4.tar.bz2。

下载地址直接上apache.org官网

[root@localhost src]# pwd
/usr/local/src
[root@localhost src]# ls
apr-1.5.1.tar.bz2  apr-util-1.5.4.tar.bz2  httpd-2.4.10.tar.bz2
[root@localhost src]# tar jxvf apr-1.5.1.tar.bz2
[root@localhost src]# tar jxvf apr-util-1.5.4.tar.bz2
[root@localhost src]# tar jxf httpd-2.4.10.tar.bz2
[root@localhost src]# mv apr-1.5.1 httpd-2.4.10/srclib/apr
[root@localhost src]# mv apr-1.5.1 httpd-2.4.10/srclib/apr-util
[root@localhost src]# more httpd-2.4.10/INSTALL

有这么一句话:download the latest versions and unpack them to ./srclib/apr and ./srclib/apr-util (no version numbers in the directory names)

编译前组件安装

[root@localhost httpd-2.4.10]# yum install -y gcc pcre-devel

配置configure及编译安装

[root@localhost httpd-2.4.10]# ./configure --prefix=/usr/local/apache2 --with-included-apr
[root@localhost httpd-2.4.10]# make
[root@localhost httpd-2.4.10]# make install

开放防火墙80端口,顺便关闭selinux,这玩意高端本人不会玩

[root@localhost ~]# vim /etc/sysconfig/iptables
...
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
...
[root@localhost ~]# /etc/init.d/iptables reload
iptables: Trying to reload firewall rules:                 [  OK  ]
[root@localhost ~]# getenforce 
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce 
Permissive

复制启动文件

[root@localhost ~]# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd 
[root@localhost ~]# chmod +x /etc/init.d/httpd
[root@localhost ~]# /etc/init.d/httpd start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message

有报错,挺不舒服的,虽然它不影响

[root@localhost ~]# vim /usr/local/apache2/conf/httpd.conf
...
ServerName 192.168.128.152
...
[root@localhost ~]# /etc/init.d/httpd graceful

客户测试访问,正常OK

 

posted @ 2015-03-27 17:25  金枪语  阅读(284)  评论(0编辑  收藏  举报