To install OpenResty on an Ubuntu-based system, first we need to import the GPG key used for signing the packages:
wget -qO - https://openresty.org/package/pubkey.gpg | apt-key add -
Like the CentOS installation, we can use a helper package to make the installation of the repository easy. To install it, use the following command:
apt install -y software-properties-common
We can now install the repository for OpenResty and then refresh the package indexes:
add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" apt update
With the repository installed, we can now install the OpenResty package:
apt install -y openresty
Once all the dependencies and OpenResty packages are installed, you can now set the service to start on boot and then start it so that you can test the service. You can do this via systemd:
systemctl enable openresty systemctl start openresty
If you don't see any errors, you will then be able browse to the IP address of your server (or virtual machine) and see the OpenResty test page, as shown in the previous CentOS installation instructions.