[iyunv@chengmanyu opt]# cd apr-1.5.2/
[iyunv@chengmanyu apr-1.5.2]# ls
......
[iyunv@chengmanyu apr-1.5.2]# ./configure --prefix=/usr/local/apr
......
[iyunv@chengmanyu apr-1.5.2]# make
......
[iyunv@chengmanyu apr-1.5.2]# make install
......
继续安装apr-util
[iyunv@chengmanyu apr-1.5.2]# cd /opt/apr-util-1.5.4/
[iyunv@chengmanyu apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
......
[iyunv@chengmanyu apr-util-1.5.4]# make
......
[iyunv@chengmanyu apr-util-1.5.4]# make install
......
继续安装pcre
[iyunv@chengmanyu apr-util-1.5.4]# cd /opt/pcre-8.40/
[iyunv@chengmanyu pcre-8.40]# ./configure --prefix=/usr/local/pcre
......
[iyunv@chengmanyu pcre-8.40]# make
......
[iyunv@chengmanyu pcre-8.40]# make install
......
这三个工具编译安装好后就可以继续httpd的安装了
[iyunv@chengmanyu httpd-2.4.25]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
(安装httpd并给出三个工具的路径)
......
[iyunv@chengmanyu httpd-2.4.25]# make
......
[iyunv@chengmanyu httpd-2.4.25]# make install
......
编译结束后如果没有报error的话,安装基本就结束了。
尝试下启动apache
启动:
[iyunv@chengmanyu httpd-2.4.25]# /usr/local/apache/bin/apachectl start
AH00557: httpd: apr_sockaddr_info_get() failed for chengmanyu.test
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(上面的问题并不影响使用,在接下来的配置中我们设置一下主机名就可以避免这个提示)
如果没有什么报错,那么apache已经开始运行了,我们检测一下我们的劳动成果。
先关掉本机的防火墙
[iyunv@chengmanyu httpd-2.4.25]# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
然后用在同一个域中的其他主机或在本机的浏览器中输入apache所在主机的 ip:80(ip+:80),浏览器跳转页面显示
it works!
到这里apache的安装已经完成了,但是现网中这样并不能直接使用还需要一些简单的设置。