Centos7学习心得一 基础配置-配置apache

Centos7学习心得一 基础配置-配置apache

yum安装

比较简单centos7中Apache可以通过yum直接安装,并解决相关依赖

yum install httpd

相关依赖软件

源码安装

想要了解Apache的安装过程,可以通过源码安装,附所需安装软件
所需软件
httpd
apr
apr-util
PCRE
EXPAT 可以通过yum安装 yum install expat-devel
下载所需软件后拷贝到centos主机 也可以使用wget命令进行下载

wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.39.tar.gz

如果提示没有安装wget yum安装即可
-bash: wget: command not found

yum install wget

tar解压

tar -xvf apr-1.7.0.tar.gz 
tar -xvf apr-util-1.6.1.tar.gz 
tar -xvf pcre-8.43.tar.gz
tar -xvf httpd-2.4.39.tar.gz

解压后将apr apr-util pcre 拷贝到httpd的srclib下

 cp-r apr-1.7.0 httpd-2.4.39/srclib/
 cp -r apr-1.7.0 httpd-2.4.39/srclib/
 cp -r apr-util-1.6.1 httpd-2.4.39/srclib/
 cp -r pcre-8.43 httpd-2.4.39/srclib/

更改文件名,要求文件和名字要一致

mv apr-1.7.0 apr
mv apr-util-1.6.1 apr-util
mv pcre-8.43 pcrebak

apr,apr-util两个在编译安装httpd的同时会自动安装,无需之前安装,但是pcre发现并没有自动安装,需要手动编译一下,cd至pcre目录进行编译安装
编译前需要安装gcc gcc-c++ expat

 yum install gcc
 yum install expat*
 yum list gcc-c++*

装pcre发现make时候报错

CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /usr/local/httpsrc/httpd-2.4.39/srclib/pcre-8.43/missing aclocal-1.16 -I m4
/usr/local/httpsrc/httpd-2.4.39/srclib/pcre-8.43/missing: line 81: aclocal-1.16: command not found
WARNING: 'aclocal-1.16' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <https://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <https://www.gnu.org/software/autoconf>
         <https://www.gnu.org/software/m4/>
         <https://www.perl.org/>
make: *** [aclocal.m4] Error 127

查了一下错误信息,网上有说是解压过程中系统时间戳的问题,没有实践,相关链接
最后发现解压后直接安装就不会出现这个问题。(不知道为什么,可能时间戳刚解完压缩是正常的)
准备工作做好准备源码安装Apache

./configure --prefix=/usr/local/httpd --enable-rewrite --enable-so --with-pcre=/usr/local/httpsrc/httpd-2.4.39/srclib/pcre
 make
make install

开放80端口

firewall-cmd --zone=public --add-port=80/tcp --permanent 
firewall-cmd --reload 

运行

 /usr/local/httpd/bin/apachectl start
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值