- http://openresty.org/cn/linux-packages.html
- RHEL
第一步:
你可以在你的 RHEL 系统中添加 openresty 仓库, 这样就可以便于未来安装或更新我们的软件包 (通过 yum check-update 命令). 添加仓库, 运行下面的命令 (对于 RHEL 8 或以上版本, 应将下面的 yum 都替换成 dnf):
- # add the yum repo:
- wget https://openresty.org/package/rhel/openresty.repo
[注意] 如同提示 ssl 连接失败, 则更新 wget 的版本为最新版本. 命令: yum update wget
- sudo mv openresty.repo /etc/yum.repos.d/
- # update the yum index:
- sudo yum check-update
[注意] 如果提示 Cannot retrieve repository metadata (repomd.xml) for repository: openresty. Please verify its path a ...
则修改
(1) 打开 / etc/yum.repos.d/xxxxxx.repo 文件
(2)enabled=1 改成 enabled=0
重新执行 yum check-update
第二步:
添加了包仓库之后就可以像下面这样安装软件包, 比如 openresty:
sudo yum install -y openresty
[注意] 提示:
- [[email protected] yum.repos.d]# yum install -y openresty-resty
- Setting up Install Process
No package openresty-resty available.
Error: Nothing to do
实在无奈, 手动下载 rpm 包, 本地安装了. 操作过程:
- https://openresty.org/package/rhel/6/x86_64/
- 2020/07/14 10:51 1,251,312 openresty-1.17.8.2-1.el6_10.x86_64.rpm
- 2020/07/14 10:55 1,647,368 openresty-openssl111-1.1.1g-3.el6_10.x86_64.rpm
- 2020/07/14 10:57 165,420 openresty-pcre-8.44-1.el6.x86_64.rpm
- 2020/07/14 11:01 13,764 openresty-resty-1.17.8.2-1.el6_10.noarch.rpm
- 2020/07/14 10:54 50,448 openresty-zlib-1.2.11-3.el6.x86_64.rpm
其中安装 openresty 的时候需要 depend 的 3 个包: zlib,pcre,openssl
- rpm -ivh openresty-openssl111-1.1.1g-3.el6_10.x86_64.rpm
- rpm -ivh openresty-pcre-8.44-1.el6.x86_64.rpm
- rpm -ivh openresty-zlib-1.2.11-3.el6.x86_64.rpm
- rpm -ivh openresty-1.17.8.2-1.el6_10.x86_64.rpm
安装 openresty-resty 的时候需要 perl 的环境:
提示: perl(Time::HiRes) is needed by openresty-resty-
解决办法: yum -y install perl perl-devel libaio libaio-devel perl-Time-HiRes
rpm -ivh openresty-resty-1.17.8.2-1.el6_10.noarch.rpm
最后发现是自己 wget 下来的 openresty.repo 中的 $release 不识别导致的. 直接将 $release 修改为自己的 RedHat 的版本号: 6, 重新执行即可识别.
如果你想安装命令行工具 resty, 那么可以像下面这样安装 openresty-resty 包:
sudo yum install -y openresty-resty
命令行工具 opm 在 openresty-opm 包里, 而 restydoc 工具在 openresty-doc 包里头.
列出所有 openresty 仓库里头的软件包:
sudo yum --disablerepo="*" --enablerepo="openresty" list available
我们的包仓库中有某些包, 比如 perl-Test-Nginx 和 perl-Lemplate, 依赖开启一些可选的 RHEL 标准包仓库. 比如 在 RHEL 6 和 RHEL 7 上, 需要启用 RHEL 官方的 Optional RPM 包仓库. 在 RHEL 7 上可以运行这条命令:
sudo subscription-manager repos --enable RHEL-7-server-optional-rpms
在 RHEL 6 上则是这样的:
sudo subscription-manager repos --enable RHEL-6-server-optional-rpms
而在 RHEL 8 上则需要开启 RHEL 官方的 CodeReady 仓库:
sudo subscription-manager repos --enable codeready-builder-for-RHEL-8-x86_64-rpms
在 OpenResty RPM 包 https://openresty.org/cn/rpm-packages.html 页面能看到这些包更多的细节.
请注意在 RHEL 8 上面缺少 perl-Lemplate 这个 RPM 包, 这是因为 RHEL 8 相比 RHEL 7 从其标准仓库中移除了 perl-Template-Toolkit 这样的 Perl 模块包.
来源: http://www.bubuko.com/infodetail-3635689.html