How to install Openresty webserver on Ubuntu 18.04

Bagaimana menginstall Openresty webserver di ubuntu 18.04

Install prerequisites yang di butuhkan untuk menambah public key

root@openresty:~# apt-get -y install --no-install-recommends wget gnupg ca-certificates
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20201027ubuntu0.18.04.1).
wget is already the newest version (1.19.4-1ubuntu2.2).
The following additional packages will be installed:
dirmngr gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server
gpgconf gpgsm libassuan0 libksba8 libnpth0 pinentry-curses
Suggested packages:
dbus-user-session pinentry-gnome3 tor parcimonie xloadimage scdaemon
pinentry-doc
The following NEW packages will be installed:
dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client
gpg-wks-server gpgconf gpgsm libassuan0 libksba8 libnpth0 pinentry-curses
0 upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 2123 kB of archives.
After this operation, 6041 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libassuan0 amd64 2.5.1-2 [35.0 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpgconf amd64 2.2.4-1ubuntu1.3 [123 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic/main amd64 libksba8 amd64 1.3.5-2 [92.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic/main amd64 libnpth0 amd64 1.5-3 [7668 B]
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 dirmngr amd64 2.2.4-1ubuntu1.3 [316 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gnupg-l10n all 2.2.4-1ubuntu1.3 [49.7 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gnupg-utils amd64 2.2.4-1ubuntu1.3 [127 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpg amd64 2.2.4-1ubuntu1.3 [467 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 pinentry-curses amd64 1.1.0-1 [35.8 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpg-agent amd64 2.2.4-1ubuntu1.3 [227 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpg-wks-client amd64 2.2.4-1ubuntu1.3 [91.8 kB]
Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpg-wks-server amd64 2.2.4-1ubuntu1.3 [85.0 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gpgsm amd64 2.2.4-1ubuntu1.3 [215 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gnupg amd64 2.2.4-1ubuntu1.3 [249 kB]
Fetched 2123 kB in 3s (624 kB/s)
Selecting previously unselected package libassuan0:amd64.
(Reading database ... 17086 files and directories currently installed.)
Preparing to unpack .../00-libassuan0_2.5.1-2_amd64.deb ...
Unpacking libassuan0:amd64 (2.5.1-2) ...
Selecting previously unselected package gpgconf.
Preparing to unpack .../01-gpgconf_2.2.4-1ubuntu1.3_amd64.deb ...
Unpacking gpgconf (2.2.4-1ubuntu1.3) ...
Selecting previously unselected package libksba8:amd64.
Preparing to unpack .../02-libksba8_1.3.5-2_amd64.deb ...
Unpacking libksba8:amd64 (1.3.5-2) ...
Selecting previously unselected package libnpth0:amd64.
Preparing to unpack .../03-libnpth0_1.5-3_amd64.deb ...
Unpacking libnpth0:amd64 (1.5-3) ...
Selecting previously unselected package dirmngr.
Preparing to unpack .../04-dirmngr_2.2.4-1ubuntu1.3_amd64.deb ...
Unpacking dirmngr (2.2.4-1ubuntu1.3) ...
Selecting previously unselected package gnupg-l10n.
Preparing to unpack .../05-gnupg-l10n_2.2.4-1ubuntu1.3_all.deb ...
Unpacking gnupg-l10n (2.2.4-1ubuntu1.3) ...
Selecting previously unselected package gnupg-utils.
Preparing to unpack .../06-gnupg-utils_2.2.4-1ubuntu1.3_amd64.deb ...
Unpacking gnupg-utils (2.2.4-1ubuntu1.3) ...
Selecting previously unselected package gpg.
Preparing to unpack .../07-gpg_2.2.4-1ubuntu1.3_amd64.deb ...
Unpacking gpg (2.2.4-1ubuntu1.3) ...
Selecting previously unselected package pinentry-curses.
Preparing to unpack .../08-pinentry-curses_1.1.0-1_amd64.deb ...
Unpacking pinentry-curses (1.1.0-1) ...
Selecting previously unselected package gpg-agent.
Preparing to unpack .../09-gpg-agent_2.2.4-1ubuntu1.3_amd64.deb ...
Unpacking gpg-agent (2.2.4-1ubuntu1.3) ...
Selecting previously unselected package gpg-wks-client.
Preparing to unpack .../10-gpg-wks-client_2.2.4-1ubuntu1.3_amd64.deb ...
Unpacking gpg-wks-client (2.2.4-1ubuntu1.3) ...
Selecting previously unselected package gpg-wks-server.
Preparing to unpack .../11-gpg-wks-server_2.2.4-1ubuntu1.3_amd64.deb ...
Unpacking gpg-wks-server (2.2.4-1ubuntu1.3) ...
Selecting previously unselected package gpgsm.
Preparing to unpack .../12-gpgsm_2.2.4-1ubuntu1.3_amd64.deb ...
Unpacking gpgsm (2.2.4-1ubuntu1.3) ...
Selecting previously unselected package gnupg.
Preparing to unpack .../13-gnupg_2.2.4-1ubuntu1.3_amd64.deb ...
Unpacking gnupg (2.2.4-1ubuntu1.3) ...
Setting up libnpth0:amd64 (1.5-3) ...
Setting up libksba8:amd64 (1.3.5-2) ...
Setting up gnupg-l10n (2.2.4-1ubuntu1.3) ...
Setting up libassuan0:amd64 (2.5.1-2) ...
Setting up gpgconf (2.2.4-1ubuntu1.3) ...
Setting up gpgsm (2.2.4-1ubuntu1.3) ...
Setting up gnupg-utils (2.2.4-1ubuntu1.3) ...
Setting up pinentry-curses (1.1.0-1) ...
Setting up dirmngr (2.2.4-1ubuntu1.3) ...
Setting up gpg (2.2.4-1ubuntu1.3) ...
Setting up gpg-agent (2.2.4-1ubuntu1.3) ...
Setting up gpg-wks-server (2.2.4-1ubuntu1.3) ...
Setting up gpg-wks-client (2.2.4-1ubuntu1.3) ...
Setting up gnupg (2.2.4-1ubuntu1.3) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for install-info (6.5.0.dfsg.1-2) ...
Processing triggers for libc-bin (2.27-3ubuntu1.3) ...

Import GPG Key:

root@openresty:~# wget -O - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
--2021-07-14 11:31:45-- https://openresty.org/package/pubkey.gpg
Resolving openresty.org (openresty.org)... 18.138.237.72
Connecting to openresty.org (openresty.org)|18.138.237.72|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1688 (1.6K) [text/plain]
Saving to: 'STDOUT'

- 100%[===================>] 1.65K --.-KB/s in 0s

2021-07-14 11:31:47 (24.3 MB/s) - written to stdout [1688/1688]

OK

Menambah repository openresty:

root@openresty:~# echo "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main" \
> | sudo tee /etc/apt/sources.list.d/openresty.list
deb http://openresty.org/package/ubuntu bionic main

Kita update terlebih dahulu repositorynya:

root@openresty:~# apt-get update
Get:1 http://openresty.org/package/ubuntu bionic InRelease [2827 B]
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://openresty.org/package/ubuntu bionic/main amd64 Packages [28.5 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2131 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [422 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [389 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [52.8 kB]
Get:10 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1739 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [371 kB]
Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [26.6 kB]
Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [6792 B]
Get:14 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages [1784 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-security/main Translation-en [329 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [365 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-security/restricted Translation-en [48.9 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1130 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic-security/universe Translation-en [256 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [19.2 kB]
Get:21 http://archive.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [4412 B]
Fetched 9284 kB in 10s (971 kB/s)
Reading package lists... Done

Selanjutnya kita install openresty dengan apt-get

root@openresty:~# apt-get -y install openresty
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libgdbm-compat4 libperl5.26 openresty-openssl111 openresty-opm
openresty-pcre openresty-resty openresty-zlib perl perl-modules-5.26
Suggested packages:
openresty-restydoc perl-doc libterm-readline-gnu-perl
| libterm-readline-perl-perl make
The following NEW packages will be installed:
libgdbm-compat4 libperl5.26 openresty openresty-openssl111 openresty-opm
openresty-pcre openresty-resty openresty-zlib perl perl-modules-5.26
0 upgraded, 10 newly installed, 0 to remove and 90 not upgraded.
Need to get 9278 kB of archives.
After this operation, 50.5 MB of additional disk space will be used.
Get:1 http://openresty.org/package/ubuntu bionic/main amd64 openresty-zlib amd64 1.2.11-3~bionic1 [54.7 kB]
Get:2 http://openresty.org/package/ubuntu bionic/main amd64 openresty-openssl111 amd64 1.1.1k-1~bionic1 [1481 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 perl-modules-5.26 all 5.26.1-6ubuntu0.5 [2762 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdbm-compat4 amd64 1.14.1-6 [6084 B]
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libperl5.26 amd64 5.26.1-6ubuntu0.5 [3534 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 perl amd64 5.26.1-6ubuntu0.5 [201 kB]
Get:7 http://openresty.org/package/ubuntu bionic/main amd64 openresty-pcre amd64 8.44-1~bionic1 [158 kB]
Get:8 http://openresty.org/package/ubuntu bionic/main amd64 openresty amd64 1.19.3.2-1~bionic1 [1048 kB]
Get:9 http://openresty.org/package/ubuntu bionic/main amd64 openresty-resty all 1.19.3.2-1~bionic1 [13.7 kB]
Get:10 http://openresty.org/package/ubuntu bionic/main amd64 openresty-opm amd64 1.19.3.2-1~bionic1 [19.2 kB]
Fetched 9278 kB in 12s (752 kB/s)
Selecting previously unselected package perl-modules-5.26.
(Reading database ... 17272 files and directories currently installed.)
Preparing to unpack .../0-perl-modules-5.26_5.26.1-6ubuntu0.5_all.deb ...
Unpacking perl-modules-5.26 (5.26.1-6ubuntu0.5) ...
Selecting previously unselected package libgdbm-compat4:amd64.
Preparing to unpack .../1-libgdbm-compat4_1.14.1-6_amd64.deb ...
Unpacking libgdbm-compat4:amd64 (1.14.1-6) ...
Selecting previously unselected package libperl5.26:amd64.
Preparing to unpack .../2-libperl5.26_5.26.1-6ubuntu0.5_amd64.deb ...
Unpacking libperl5.26:amd64 (5.26.1-6ubuntu0.5) ...
Selecting previously unselected package perl.
Preparing to unpack .../3-perl_5.26.1-6ubuntu0.5_amd64.deb ...
Unpacking perl (5.26.1-6ubuntu0.5) ...
Selecting previously unselected package openresty-zlib.
Preparing to unpack .../4-openresty-zlib_1.2.11-3~bionic1_amd64.deb ...
Unpacking openresty-zlib (1.2.11-3~bionic1) ...
Selecting previously unselected package openresty-openssl111.
Preparing to unpack .../5-openresty-openssl111_1.1.1k-1~bionic1_amd64.deb ...
Unpacking openresty-openssl111 (1.1.1k-1~bionic1) ...
Selecting previously unselected package openresty-pcre.
Preparing to unpack .../6-openresty-pcre_8.44-1~bionic1_amd64.deb ...
Unpacking openresty-pcre (8.44-1~bionic1) ...
Selecting previously unselected package openresty.
Preparing to unpack .../7-openresty_1.19.3.2-1~bionic1_amd64.deb ...
Unpacking openresty (1.19.3.2-1~bionic1) ...
Selecting previously unselected package openresty-resty.
Preparing to unpack .../8-openresty-resty_1.19.3.2-1~bionic1_all.deb ...
Unpacking openresty-resty (1.19.3.2-1~bionic1) ...
Selecting previously unselected package openresty-opm.
Preparing to unpack .../9-openresty-opm_1.19.3.2-1~bionic1_amd64.deb ...
Unpacking openresty-opm (1.19.3.2-1~bionic1) ...
Setting up openresty-pcre (8.44-1~bionic1) ...
Setting up openresty-zlib (1.2.11-3~bionic1) ...
Setting up openresty-openssl111 (1.1.1k-1~bionic1) ...
Setting up perl-modules-5.26 (5.26.1-6ubuntu0.5) ...
Setting up libgdbm-compat4:amd64 (1.14.1-6) ...
Setting up openresty (1.19.3.2-1~bionic1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/openresty.service -> /lib/systemd/system/openresty.service.
Setting up libperl5.26:amd64 (5.26.1-6ubuntu0.5) ...
Setting up perl (5.26.1-6ubuntu0.5) ...
Setting up openresty-resty (1.19.3.2-1~bionic1) ...
Setting up openresty-opm (1.19.3.2-1~bionic1) ...
Processing triggers for systemd (237-3ubuntu10.43) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.27-3ubuntu1.3) ...
root@openresty:~#

Kita Test apakah sudah berjalan

root@openresty:~# curl -sI localhost
HTTP/1.1 200 OK
Server: openresty/1.19.3.2
Date: Wed, 14 Jul 2021 11:39:56 GMT
Content-Type: text/html
Content-Length: 1097
Last-Modified: Tue, 01 Jun 2021 04:50:37 GMT
Connection: keep-alive
ETag: "60b5bc9d-449"
Accept-Ranges: bytes

root@openresty:~#

Administrator

Saya adalah saya, dimana saya tinggal disitu saya berada. Saya suka menulis disela kesibukan saya, tapi saat sibuk saya tidak bisa menyempatkan waktu untuk menulis.

Leave a Reply

Your email address will not be published. Required fields are marked *