adapted instructions from https://blog.openresty.com/en/ubuntu20-or-install/
apt update
# install wget and gpg for apt key downloading
apt install -y wget gpg gnupg-l10n-
# add openresty key
wget -O - https://openresty.org/package/pubkey.gpg \
| gpg --dearmor \
| tee /etc/apt/trusted.gpg.d/openresty.gpg \
> /dev/null
arch=$(case $(uname -m) in x86_64) echo amd64;; arm64) echo arm64;; *) echo all;; esac)
c=$(. /etc/os-release; echo $VERSION_CODENAME)
# add openresty repo
# 'lsb_release -sc' not available in minimal envs
echo "deb [arch=$arch signed-by=/etc/apt/trusted.gpg.d/openresty.gpg] http://openresty.org/package/ubuntu $c main" \
| tee /etc/apt/sources.list.d/openresty.list \
> /dev/null
apt update
# no curl and no perl
#apt install -y openresty curl- perl-
apt install -y --no-install-recommends openresty
{ dnf -h > /dev/null 2>&1 && dnf=dnf; } || { microdnf -h > /dev/null 2>&1 && dnf=microdnf; } || { echo no dnf; false; }
. /etc/os-release; ver=${VERSION:0:1}
case $ver in
8) url=https://openresty.org/package/rhel/openresty.repo;;
9) url=https://openresty.org/package/rhel/openresty2.repo;;
esac
curl -fSs $url > /etc/yum.repos.d/openresty.repo
$dnf install -y openresty