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

LAMP搭建2:Apache安装

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2017-1-12 09:13:04 | 显示全部楼层 |阅读模式
1.进入/usr/local/src/目录下去下载Apache的安装包httpd-2.2.29.tar.gz
[iyunv@CentOS6 support-files]# cd /usr/local/src
[iyunv@CentOS6 src]# ls
httpd-2.2.9.tar.gz
2.解压安装包
[iyunv@CentOS6 src]# tar zxvf httpd-2.2.9.tar.gz
3.进入安装目录
[iyunv@CentOS6 src]# cd httpd-2.2.9
[iyunv@CentOS6 httpd-2.2.9]# ls
ABOUT_APACHE      CHANGES        include         modules           srclib
acinclude.m4      config.layout  INSTALL         NOTICE            support
Apache.dsw        configure      InstallBin.dsp  NWGNUmakefile     test
apachenw.mcp.zip  configure.in   LAYOUT          os                VERSIONING
build             docs           libhttpd.dsp    README
BuildAll.dsp      emacs-style    LICENSE         README.platforms
BuildBin.dsp      httpd.dsp      Makefile.in     ROADMAP
buildconf         httpd.spec     Makefile.win    server
4.查看安装说明文件INSTALL可以看到安装步骤
……
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start
……
5.使用下面的参数配置安装选项,回车即可
[iyunv@CentOS6 httpd-2.2.9]# ./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --with-pcre
其中:
--prefix                                指定安装目录
--with-include-apr                依赖包apr,支持httpd,可以跨平台运作
--with-pcre                        正则相关的库
shared表示以动态共享的方式安装
有错改错,缺少什么库就安装:
如checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
yum install  zlib-devel
6.直到配置没有问题然后开始编译
[iyunv@CentOS6 httpd-2.2.9]# echo $?
0
[iyunv@CentOS6 httpd-2.2.9]# make
7.编译没问题然后开始安装
[iyunv@CentOS6 httpd-2.2.9]# echo $?
0
[iyunv@CentOS6 httpd-2.2.9]# make install
8.安装成功
[iyunv@CentOS6 httpd-2.2.9]# echo $?
0
[iyunv@CentOS6 httpd-2.2.9]# ls /usr/local/apache2/
bin    cgi-bin  error   icons    lib   man     modules
build  conf     htdocs  include  logs  manual
9.现在还不能直接运行,需要编辑Apache主配置文件httpd.conf:
[iyunv@CentOS6 httpd-2.2.9]# vim /usr/local/apache2/conf/httpd.conf
将ServerName改为localhost:80,去掉前面的注释符#
……
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80
……
10.将Apache加入系统环境变量:
[iyunv@CentOS6 support-files]# vim /etc/profile.d/path.sh
#!/bin/bash
export PATH=$PATH:/etc/init.d/:/usr/local/mysql/bin/:/usr/local/apache2/bin/
[iyunv@CentOS6 support-files]# source /etc/profile.d/path.sh
11.检查配置是否正确,正确则启动Apache
[iyunv@CentOS6 httpd-2.2.9]# apachectl -t
Syntax OK
[iyunv@CentOS6 httpd-2.2.9]# apachectl start
httpd (pid 22581) already running
12.查看Apache的进程和端口
[iyunv@CentOS6 httpd-2.2.9]# ps aux|grep httpd
[iyunv@CentOS6 httpd-2.2.9]# netstat -lnp


运维网声明 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-327291-1-1.html 上篇帖子: LAMP搭建1:MySQL安装 下篇帖子: LAMP搭建3:PHP安装
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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