OpenResty安装教程

本人热衷于仓库预编译包。编译安装一点都不适合我。

ubuntu

# 安装导入 GPG 公钥时所需的几个依赖包(整个安装过程完成后可以随时删除它们):
sudo apt-get -y install --no-install-recommends wget gnupg ca-certificates

# 导入我们的 GPG 密钥:
wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add -

# 安装 add-apt-repository 命令
# (之后你可以删除这个包以及对应的关联包)
sudo apt-get -y install --no-install-recommends software-properties-common

# 添加我们官方 official APT 仓库:
sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"

# 更新 APT 索引:
sudo apt-get update

#然后就可以像下面这样安装软件包,比如 openresty:
sudo apt-get -y install openresty

#这个包同时也推荐安装 openresty-opm 和 openresty-restydoc 包,所以后面两个包会缺省安装上。 如果你不想自动关联安装,可以用下面方法关闭自动关联安装:
sudo apt-get -y install --no-install-recommends openresty

debian

# 安装导入 GPG 公钥时所需的几个依赖包(整个安装过程完成后可以随时删除它们):
sudo apt-get -y install --no-install-recommends wget gnupg ca-certificates

# 导入我们的 GPG 密钥:
wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add -

# 安装 add-apt-repository 命令
# (之后你可以删除这个包以及对应的关联包)
sudo apt-get -y install --no-install-recommends software-properties-common

# 添加我们官方 official APT 仓库:
sudo add-apt-repository -y "deb http://openresty.org/package/debian $(lsb_release -sc) openresty"

# 更新 APT 索引:
sudo apt-get update

#然后就可以像下面这样安装软件包,比如 openresty:
sudo apt-get -y install openresty

#这个包同时也推荐安装 openresty-opm 和 openresty-restydoc 包,所以后面两个包会缺省安装上。 如果你不想自动关联安装,可以用下面方法关闭自动关联安装:
sudo apt-get -y install --no-install-recommends openresty

centos

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo

#然后就可以像下面这样安装软件包,比如 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

REHL

你可以在你的 RHEL 系统中添加 openresty 仓库,这样就可以便于未来安装或更新我们的软件包(通过 yum check-update 命令)。添加仓库,运行下面的命令:

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://openresty.org/package/rhel/openresty.repo
在想 RHEL 6.x 这样的老系统上,最后那条命令可能因为 yum-config-manager 命令的内部问题,生成下面的错误:

[Errno 14] Peer cert cannot be verified or peer cert invalid
如果出现上述问题,你可以用下面的命令添加仓库:

sudo yum-config-manager --add-repo http://openresty.org/package/rhel/openresty.repo
添加了包仓库之后就可以像下面这样安装软件包,比如 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
我们的包仓库中有某些包,比如 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 包 页面能看到这些包更多的细节。

请注意在 RHEL 8 上面缺少 perl-Lemplate 这个 RPM 包,这是因为 RHEL 8 相比 RHEL 7 从其标准仓库中移除了 perl-Template-Toolkit 这样的 Perl 模块包。

Fedora

Fedora
在 Fedora 系统中你可以这样来启用 openresty 仓库:

sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://openresty.org/package/fedora/openresty.repo
然后你就可以方便的从 openresty-openresty 仓库中安装和更新包(通过 dnf update 命令)。 比如我们可以运行下面的命令来安装 openresty:

sudo dnf install -y openresty
如果想安装 resty 命令行工具,则像下面这样安装 openresty-resty 软件包:

sudo dnf install -y openresty-resty
命令行工具 opm 在 openresty-opm 包里,而 restydoc 工具在 openresty-doc 包里头。

列出在 openresty-openresty 仓库中所有可用的包, 可以这样

sudo dnf repo-pkgs openresty-openresty list available

官方页面 https://openresty.org/cn/linux-packages.html

https://foxi.buduanwang.vip/linux/433.html/
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇