前提:1.这个centos操作系统能上网
2.yum 安装apr,apr-util,zlib-devel,groupinstall Development Tools,gcc
1.在apache的官网,下载apache的源码包,地址如下
http://httpd.apache.org/download.cgi,下载这两个中的一个
2.利用xftp上传到centos系统/localdisk下,并解压到/localdisk/service
3.切换路径到/localdisk/service/httpd-2.4.34下面,查看文件INTALL
发现编译安装就四步
注意:一定要在这个路径下面/localdisk/service/httpd-2.4.34
4. ./configure后面的参数有很多,我就举两个例子
./configure --prefix=/localdisk/http(配置文件的存放路径)
--sysconfdir=/localdisk/http/conf/(httpd的配置文件的存放路径)
执行后,会在其目录下出现一个编译文件
5.在当前目录下,执行make && make install,要是没报错,在/localdisk/http,可以看到配置http的文件
6.关闭防火墙,并开启http服务
systemctl stop firewalld
/localdisk/http/bin/apachectl start (临时启动)
7.修改配置文件/localdisk/http/conf/httpd.conf
8.把该服务永久启用
chmod +x /localdisk/http/bin/apachectl
echo /localdisk/http /bin/apachectl start >> /etc/rc.local
效果图:在浏览器上输入ip地址
=============================================================
报错:make阶段
解决方法:
重新编译下加红字参数./configure --prefix=/localdisk/http --disable-proxy --with-include-apr,之后执行make && make install