This tutorial is a deep dive from our comprehensive Install OpenResty guide. If you are looking for setup instructions on other platforms like Ubuntu, RHEL/CentOS, Alpine, or macOS, be sure to check out the complete hub.

This guide was written for Debian 11, but the steps are essentially the same on Debian 12 — only the Step 2 command for importing the GPG key differs, and both versions are listed below. Debian 13 is not supported by the official repository yet.

Now we provide official OpenResty packages repos for Debian 11 Bullseye (includes both x86_64 and aarch64 architectures). Feedback is always welcome. Thanks a lot!

Installation

Note: if nginx is already installed and running, try disabling and stopping it before installing openresty like below:

sudo systemctl disable nginx
sudo systemctl stop nginx

Otherwise the installation might fail.

You can add the openresty repository to your Debian system so as to easily install our packages and receive updates in the future (via the apt-get update command).

To add the repository, just run the following commands (only need to run once for each system):

Step 1: install some prerequisites needed by adding GPG public keys (could be removed later):

sudo apt-get -y install --no-install-recommends wget gnupg ca-certificates

Step 2: import our GPG key:

For Debian 11:

wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add -

For Debian 12:

wget -O - https://openresty.org/package/pubkey.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/openresty.gpg

Step 3: add the our official APT repository.

For x86_64 or amd64 systems:

codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release`

echo "deb https://openresty.org/package/debian $codename openresty" \
    | sudo tee /etc/apt/sources.list.d/openresty.list

And for arm64 or aarch64 systems:

codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release`

echo "deb https://openresty.org/package/arm64/debian $codename openresty" \
    | sudo tee /etc/apt/sources.list.d/openresty.list

Step 4: update the APT index:

sudo apt-get update

Then you can install a package, say, openresty, like this:

sudo apt-get -y install openresty

This package also recommends the openresty-opm and openresty-restydoc packages so the latter two will also automatically get installed by default. If that is not what you want, you can disable the automatic installation of recommended packages like this:

sudo apt-get -y install --no-install-recommends openresty

See the OpenResty Deb Packages page for more details on all available packages in this repository.

More

Check out Linux Packages page for more information about the official OpenResty package repository.

Feedback is always welcome. Thanks a lot!


Previous step: Install OpenResty: Complete Setup Guide for All Platforms
Next step: Hello World HTTP Example in OpenResty