安装apache服务器CentOS Linux release 7.6.1810 (Core)

项目开发需要url和服务器,买域名后备案需要至少3月的可用服务器。
然后需要部署下服务器,先安装apache,之前需要先安装jdk

一 安装准备

  1. 切换到root用户,在/usr/local目录下,新建middleware、apr、apr-util三个文件
[root@sitweb1 local]# cd /usr/local
[root@sitweb1 local]# mkdir apr middleware apr-util
  1. 将apr-1.7.0.tar.gz、apr-util-1.6.1.tar.gz、httpd-2.4.23.tar.gz上传到/usr/local/middleware目录下
    下载路径:
    apr的两个文件:http://archive.apache.org/dist/apr/
    httpd:https://downloads.apache.org/httpd/

  2. 在/usr/local/middleware文件夹解压

[root@sitweb1 middleware]# tar -xzf apr-1.7.02.tar.gz
[root@sitweb1 middleware]# tar -xzf apr-util-1.6.1.tar.gz
[root@sitweb1 middleware]# tar -xzf httpd-2.4.23.tar.gz 

二 安装apr

这个最简单

  1. 配置
[root@sitweb1 middleware]# cd apr-1.5.2
[root@sitweb1 apr-1.5.2]# ./configure --prefix=/usr/local/apr/
  1. 编译、安装
[root@sitweb1 apr-1.5.2]# make
[root@sitweb1 apr-1.5.2]# make install

三 安装apr-util

  1. 配置

需要提前安装gcc-c++,我买的的腾讯服务器CentOS Linux release 7.6.1810 (Core),默认安装了gcc没有安装gcc-c++

[root@sitweb1 middleware]# cd apr-util-1.5.4
[root@VM_0_3_centos apr-util-1.6.1]# yum install gcc-c++
[root@sitweb1 apr-util-1.5.4]# ./configure
--prefix=/usr/local/apr-util/ -with-apr=/usr/local/apr/
  1. 编译、安装
[root@sitweb1 apr-util-1.5.4]# make

[root@sitweb1 apr-util-1.5.4]# make install

make报错:

[root@VM_0_3_centos apr-util-1.6.1]# make
make[1]: Entering directory `/usr/local/middleware/apr-util-1.6.1'
/bin/sh /usr/local/apr//build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/usr/local/middleware/apr-util-1.6.1/include -I/usr/local/middleware/apr-util-1.6.1/include/private  -I/usr/local/apr//include/apr-1    -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
 #include <expat.h>
                   ^
compilation terminated.
make[1]: *** [xml/apr_xml.lo] Error 1
make[1]: Leaving directory `/usr/local/middleware/apr-util-1.6.1'
make: *** [all-recursive] Error 1

这个需要安装expat-devel

[root@VM_0_3_centos apr-util-1.6.1]# yum install expat-devel -y

正常解析最后一行显示这个不用管,可以看
https://editor.csdn.net/md/?articleId=106050070,是因为我们指定了安装路径

make[1]: Leaving directory `/usr/local/middleware/apr-util-1.6.1'

四 安装apache

  1. 配置
[root@sitweb1 middleware]# cd httpd-2.4.23

[root@sitweb1 httpd-2.4.23]# ./configure --with-apr=/usr/local/apr/
--with-apr-util=/usr/local/apr-util/

还是少依赖

[root@VM_0_3_centos httpd-2.4.43]# ./configure --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
...

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

安装依赖pcre-devel

yum -y install pcre-devel
  1. 编译、安装
    make&&make install
    建议分开,报错好找
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值