当前位置:   article > 正文

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

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
  • 2
  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 
  • 1
  • 2
  • 3

二 安装apr

这个最简单

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

三 安装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
  • 2
  • 3
  • 4
  1. 编译、安装
[root@sitweb1 apr-util-1.5.4]# make

[root@sitweb1 apr-util-1.5.4]# make install
  • 1
  • 2
  • 3

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

这个需要安装expat-devel

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

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

make[1]: Leaving directory `/usr/local/middleware/apr-util-1.6.1'
  • 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/
  • 1
  • 2
  • 3
  • 4

还是少依赖

[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/
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

安装依赖pcre-devel

yum -y install pcre-devel
  • 1
  1. 编译、安装
    make&&make install
    建议分开,报错好找
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/328129
推荐阅读
相关标签
  

闽ICP备14008679号