设为首页 收藏本站
查看: 1078|回复: 0

[经验分享] Linux rhel 6.4 apache编译安装以及简单配置过程

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2017-3-24 11:05:53 | 显示全部楼层 |阅读模式
注:以下摘取的都是安装过程中执行的命令,命令反馈没有贴出来以"......"代替。观看的时候注意执行命令时所在的目录。


安装平台

[iyunv@chengmanyu ~]# cat /etc/redhat-release

Red Hat Enterprise Linux Server release 6.4 (Santiago)

需要的工具版本以及下载地址
1.httpd-2.4.25.tar.gz
(http://httpd.apache.org/download.cgi#apache24)
2.apr-1.5.2.tar.gz
(http://apr.apache.org/download.cgi)
3.apr-util-1.5.4.tar.gz
(http://apr.apache.org/download.cgi)
4.pcre-8.40.tar.gz
(https://ftp.pcre.org/pub/pcre/)

下载好以后将这些工具上传到Linux的/media目录下。(我上传使用了winSCP工具)

解压缩
[iyunv@chengmanyu media]# cd /media/
[iyunv@chengmanyu media]# tar zxvf apr-1.5.2.tar.gz -C /opt/
......
[iyunv@chengmanyu media]# tar zxvf apr-util-1.5.4\ .tar.gz -C /opt/
......
[iyunv@chengmanyu media]# tar zxvf pcre-8.40.tar.gz -C /opt/
......
[iyunv@chengmanyu media]# tar zxvf httpd-2.4.25.tar.gz -C /opt/
......

解压好后进入/opt目录,查看一下解压的结果
[iyunv@chengmanyu media]# cd /opt/
[iyunv@chengmanyu opt]# ls
apr-1.5.2  apr-util-1.5.4  httpd-2.4.25  pcre-8.40  rh

检查一下是否有Linux自带的httpd服务,如果有需要关闭相关的服务并用rpm卸载httpd相关的包。
[iyunv@chengmanyu opt]# rpm -qa | grep httpd
[iyunv@chengmanyu opt]#
我这里并之前并没有安装httpd相关的包。

安装httpd还需要gcc-c++
[iyunv@chengmanyu opt]# yum -y install gcc-c++*
......

安装apr apr-util以及pcre三个工具,如果不安装这三个工具编译httpd的时候会报错,提示需要这三个工具。
安装apr

[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的安装已经完成了,但是现网中这样并不能直接使用还需要一些简单的设置。


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-354560-1-1.html 上篇帖子: apache调优技巧之一隐藏apahce版本信息 下篇帖子: Apache 源码安装和配置 Linux
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表