项目开发需要url和服务器,买域名后备案需要至少3月的可用服务器。
然后需要部署下服务器,先安装apache,之前需要先安装jdk
一 安装准备
- 切换到root用户,在/usr/local目录下,新建middleware、apr、apr-util三个文件
[root@sitweb1 local]# cd /usr/local
[root@sitweb1 local]# mkdir apr middleware apr-util
-
将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/ -
在/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
这个最简单
- 配置
[root@sitweb1 middleware]# cd apr-1.5.2
[root@sitweb1 apr-1.5.2]# ./configure --prefix=/usr/local/apr/
- 编译、安装
[root@sitweb1 apr-1.5.2]# make
[root@sitweb1 apr-1.5.2]# make install
三 安装apr-util
- 配置
需要提前安装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/
- 编译、安装
[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
- 配置
[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
- 编译、安装
make&&make install
建议分开,报错好找