【环境搭建】基于centos搭建openresty环境

787 阅读1分钟

基于centos搭建openresty环境

环境确认

cat /etc/redhat-release



#   CentOS Linux release 7.6.1810 (Core)

官方文档

OpenResty - 安装

OpenResty 官方博客

官方视频号

space.bilibili.com/457424101

安装前准备

yum install pcre-devel openssl-devel gcc curl

安装教程

第一种方式

预编译包 (openresty.org/cn/linux-pa…)

 # add the yum repo:

wget https://openresty.org/package/centos/openresty.repo

sudo mv openresty.repo /etc/yum.repos.d/

 # update the yum index:

sudo yum check-update

# 然后就可以像下面这样安装软件包,比如 openresty:

sudo yum install -y openresty

# 如果你想安装命令行工具 resty,那么可以像下面这样安装 openresty-resty 包:

sudo yum install -y openresty-resty



#命令行工具 opm 在 openresty-opm 包里,而 restydoc 工具在 openresty-doc 包里头。

#列出所有 openresty 仓库里头的软件包:

sudo yum --disablerepo="*" --enablerepo="openresty" list available

第二种方式

安装包编译 (openresty.org/cn/installa…)



#下载安装包

wget https://openresty.org/download/openresty-1.19.9.1.tar.gz



#解压安装包

tar -xzvf openresty-1.19.9.1.tar.gz



cd openresty-1.19.9.1

# 默认安装在/usr/local/openresty目录下

./configure --prefix=/opt/openresty \

            --with-luajit \

            --without-http_redis2_module \

            --with-http_iconv_module \

            --with-http_postgres_module

make && make install