Linux学习之CentOS 7源码安装openresty

在CentOS7.6上,安装OpenResty时遇到PCRE和OpenSSL库的问题。通过运行`yuminstall`命令分别安装pcre-devel,openssl和openssl-devel来解决依赖问题,然后重新执行`./configure`和`gmakeinstall`完成OpenResty的安装。
摘要由CSDN通过智能技术生成

https://github.com/openresty/openresty/tags里边有openresty各个版本的源码。
在这里插入图片描述

https://openresty.org/en/是官网。

cat /etc/redhat-release可以看到操作系统的版本是CentOS Linux release 7.6.1810 (Core)uname -r可以看到内核版本是3.10.0-957.el7.x86_64gmake --version可以看到版本是GNU Make 3.82
在这里插入图片描述

wget https://github.com/openresty/openresty/archive/refs/tags/v1.15.8.1.tar.gz(github网址)或者wget https://openresty.org/download/openresty-1.15.8.1.tar.gz(官网)下载源码包。
在这里插入图片描述
tar zxf openresty-1.15.8.1.tar.gz && cd openresty-1.15.8.1解压文件。
在这里插入图片描述

./configure --prefix=/usr/local/openresty,源码里边已经有环境配置了,但是需要使用此步骤进行匹配,比如内核版本、gcc安装目录和版本,同时也说明将会安装到/usr/local/openresty目录里边。

在这里插入图片描述
发现报错如下:

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

ERROR: failed to run command: sh ./configure --prefix=/usr/local/openresty/nginx \...

在这里插入图片描述

yum install -y pcre-devel安装pcre-devel
在这里插入图片描述

再次执行./configure --prefix=/usr/local/openresty
在这里插入图片描述

发现报错如下:

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

ERROR: failed to run command: sh ./configure --prefix=/usr/local/openresty/nginx \...

在这里插入图片描述

yum install -y openssl安装openssl
在这里插入图片描述

再次执行./configure --prefix=/usr/local/openresty
在这里插入图片描述

发现还是报错如下:

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

ERROR: failed to run command: sh ./configure --prefix=/usr/local/openresty/nginx \...

在这里插入图片描述

yum install -y openssl-devel安装openssl-devel
在这里插入图片描述
再次执行./configure --prefix=/usr/local/openresty
在这里插入图片描述

完成之后,如下图所示:

在这里插入图片描述

gmake进行编译。
在这里插入图片描述

完成如下:
在这里插入图片描述

gmake install进行安装。
在这里插入图片描述

完成之后如下:
在这里插入图片描述

​此文章为6月Day 24学习笔记,内容来源于极客时间《Linux 实战技能 100 讲》

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值