Paso 1: instala Nginx

Cómo instalar Nginx en CentOS 8

Paso 2: descargar fuentes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cd /usr/local/src
# Downloading Nginx
NGINX_VERSION=$(nginx -v 2>&1 | awk -F/ '{print $2}')
wget https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz
# Downloading Lua
# Downloading Nginx development kit
# Downloading Nginx Lua Module
# Downloading Resty Core
# Downloading Resty LRU Cache

Resultado:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
dieciséis
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
sesenta y cinco
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
[root@tutorialspots ~]# cd /usr/local/src
[root@tutorialspots src]# # Downloading Nginx
[root@tutorialspots src]# NGINX_VERSION=$(nginx -v 2>&1 | awk -F/ '{print $2}')
[root@tutorialspots src]# wget https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz
Resolving nginx.org (nginx.org)... 2001:1af8:4060:a004:21::e3, 95.211.80.227, 62.210.92.35
Connecting to nginx.org (nginx.org)|2001:1af8:4060:a004:21::e3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1014040 (990K) [application/octet-stream]
Saving to: ‘nginx-1.14.1.tar.gz’
 
nginx-1.14.1.tar.gz 100%[===================>] 990.27K  --.-KB/s    in 0.1s
 
2020-07-08 06:41:23 (9.25 MB/s) - ‘nginx-1.14.1.tar.gz’ saved [1014040/1014040]
 
[root@tutorialspots src]# # Downloading Lua
Resolving github.com (github.com)... 140.82.118.3
Connecting to github.com (github.com)|140.82.118.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Resolving codeload.github.com (codeload.github.com)... 140.82.113.10
Connecting to codeload.github.com (codeload.github.com)|140.82.113.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v2.1-20200102.tar.gz’
 
v2.1-20200102.tar.g     [   <=>              ]   1.04M  1.98MB/s    in 0.5s
 
2020-07-08 06:41:25 (1.98 MB/s) - ‘v2.1-20200102.tar.gz’ saved [1093752]
 
[root@tutorialspots src]# # Downloading Nginx development kit
Resolving github.com (github.com)... 140.82.118.4
Connecting to github.com (github.com)|140.82.118.4|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Reusing existing connection to github.com:443.
HTTP request sent, awaiting response... 302 Found
Resolving codeload.github.com (codeload.github.com)... 140.82.113.9
Connecting to codeload.github.com (codeload.github.com)|140.82.113.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v0.3.1.tar.gz’
 
v0.3.1.tar.gz           [ <=>                ]  64.98K   371KB/s    in 0.2s
 
2020-07-08 06:41:26 (371 KB/s) - ‘v0.3.1.tar.gz’ saved [66542]
 
[root@tutorialspots src]# # Downloading Nginx Lua Module
Resolving github.com (github.com)... 140.82.118.4
Connecting to github.com (github.com)|140.82.118.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Resolving codeload.github.com (codeload.github.com)... 140.82.113.10
Connecting to codeload.github.com (codeload.github.com)|140.82.113.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v0.10.15.tar.gz’
 
v0.10.15.tar.gz         [  <=>               ] 639.76K  1.42MB/s    in 0.4s
 
2020-07-08 06:41:27 (1.42 MB/s) - ‘v0.10.15.tar.gz’ saved [655110]
 
[root@tutorialspots src]# # Downloading Resty Core
Resolving github.com (github.com)... 140.82.118.4
Connecting to github.com (github.com)|140.82.118.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Resolving codeload.github.com (codeload.github.com)... 140.82.113.10
Connecting to codeload.github.com (codeload.github.com)|140.82.113.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v0.1.17.tar.gz’
 
v0.1.17.tar.gz          [  <=>               ] 147.45K   561KB/s    in 0.3s
 
2020-07-08 06:41:28 (561 KB/s) - ‘v0.1.17.tar.gz’ saved [150985]
 
[root@tutorialspots src]# # Downloading Resty LRU Cache
Resolving github.com (github.com)... 140.82.118.4
Connecting to github.com (github.com)|140.82.118.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Resolving codeload.github.com (codeload.github.com)... 140.82.113.10
Connecting to codeload.github.com (codeload.github.com)|140.82.113.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v0.09.tar.gz’
 
v0.09.tar.gz            [ <=>                ]  14.60K  --.-KB/s    in 0.09s
 
2020-07-08 06:41:36 (167 KB/s) - ‘v0.09.tar.gz’ saved [14954]

Paso 3: instale tar make gcc gcc-c ++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
dieciséis
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[root@tutorialspots src]# yum install tar
Last metadata expiration check: 0:14:38 ago on Wed 08 Jul 2020 06:31:28 AM CEST.
Dependencies resolved.
================================================================================
 Package       Architecture     Version                  Repository        Size
================================================================================
Installing:
 tar           x86_64           2:1.30-4.el8             BaseOS           838 k
 
Transaction Summary
================================================================================
Install  1 Package
 
Total download size: 838 k
Installed size: 2.8 M
Is this ok [y/N]: y
Downloading Packages:
tar-1.30-4.el8.x86_64.rpm                       6.7 MB/s | 838 kB     00:00
--------------------------------------------------------------------------------
Total                                           5.4 MB/s | 838 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : tar-2:1.30-4.el8.x86_64                                1/1
  Running scriptlet: tar-2:1.30-4.el8.x86_64                                1/1
  Verifying        : tar-2:1.30-4.el8.x86_64                                1/1
 
Installed:
  tar-2:1.30-4.el8.x86_64
 
Complete!
1
yum install make gcc gcc-c++

Resultado:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
dieciséis
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
sesenta y cinco
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
[root@tutorialspots src]# yum install make gcc gcc-c++
Last metadata expiration check: 0:22:33 ago on Wed 08 Jul 2020 06:31:28 AM CEST.
Dependencies resolved.
================================================================================
 Package             Arch       Version                     Repository     Size
================================================================================
Installing:
 gcc                 x86_64     8.3.1-5.el8.0.2             AppStream      23 M
 gcc-c++             x86_64     8.3.1-5.el8.0.2             AppStream      12 M
 make                x86_64     1:4.2.1-10.el8              BaseOS        498 k
Installing dependencies:
 binutils            x86_64     2.30-73.el8                 BaseOS        5.7 M
 cpp                 x86_64     8.3.1-5.el8.0.2             AppStream      10 M
 glibc-devel         x86_64     2.28-101.el8                BaseOS        1.0 M
 glibc-headers       x86_64     2.28-101.el8                BaseOS        473 k
 isl                 x86_64     0.16.1-6.el8                AppStream     841 k
 kernel-headers      x86_64     4.18.0-193.6.3.el8_2        BaseOS        4.0 M
 libmpc              x86_64     1.0.2-9.el8                 AppStream      59 k
 libstdc++-devel     x86_64     8.3.1-5.el8.0.2             AppStream     2.0 M
 libxcrypt-devel     x86_64     4.1.1-4.el8                 BaseOS         25 k
 
Transaction Summary
================================================================================
Install  12 Packages
 
Total download size: 61 M
Installed size: 165 M
Is this ok [y/N]: y
Downloading Packages:
(1/12): cpp-8.3.1-5.el8.0.2.x86_64.rpm           16 MB/s |  10 MB     00:00
(2/12): gcc-c++-8.3.1-5.el8.0.2.x86_64.rpm       16 MB/s |  12 MB     00:00
(3/12): isl-0.16.1-6.el8.x86_64.rpm             7.2 MB/s | 841 kB     00:00
(4/12): libmpc-1.0.2-9.el8.x86_64.rpm           2.1 MB/s |  59 kB     00:00
(5/12): libstdc++-devel-8.3.1-5.el8.0.2.x86_64.  20 MB/s | 2.0 MB     00:00
(6/12): binutils-2.30-73.el8.x86_64.rpm          28 MB/s | 5.7 MB     00:00
(7/12): glibc-devel-2.28-101.el8.x86_64.rpm     8.2 MB/s | 1.0 MB     00:00
(8/12): glibc-headers-2.28-101.el8.x86_64.rpm    24 MB/s | 473 kB     00:00
(9/12): gcc-8.3.1-5.el8.0.2.x86_64.rpm           20 MB/s |  23 MB     00:01
(10/12): libxcrypt-devel-4.1.1-4.el8.x86_64.rpm 162 kB/s |  25 kB     00:00
(11/12): kernel-headers-4.18.0-193.6.3.el8_2.x8  21 MB/s | 4.0 MB     00:00
(12/12): make-4.2.1-10.el8.x86_64.rpm           5.0 MB/s | 498 kB     00:00
--------------------------------------------------------------------------------
Total                                            46 MB/s |  61 MB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : libmpc-1.0.2-9.el8.x86_64                             1/12
  Running scriptlet: libmpc-1.0.2-9.el8.x86_64                             1/12
  Installing       : cpp-8.3.1-5.el8.0.2.x86_64                            2/12
  Running scriptlet: cpp-8.3.1-5.el8.0.2.x86_64                            2/12
  Installing       : kernel-headers-4.18.0-193.6.3.el8_2.x86_64            3/12
  Running scriptlet: glibc-headers-2.28-101.el8.x86_64                     4/12
  Installing       : glibc-headers-2.28-101.el8.x86_64                     4/12
  Installing       : libxcrypt-devel-4.1.1-4.el8.x86_64                    5/12
  Installing       : glibc-devel-2.28-101.el8.x86_64                       6/12
  Running scriptlet: glibc-devel-2.28-101.el8.x86_64                       6/12
  Installing       : binutils-2.30-73.el8.x86_64                           7/12
  Running scriptlet: binutils-2.30-73.el8.x86_64                           7/12
  Installing       : libstdc++-devel-8.3.1-5.el8.0.2.x86_64                8/12
  Installing       : isl-0.16.1-6.el8.x86_64                               9/12
  Running scriptlet: isl-0.16.1-6.el8.x86_64                               9/12
  Installing       : gcc-8.3.1-5.el8.0.2.x86_64                           10/12
  Running scriptlet: gcc-8.3.1-5.el8.0.2.x86_64                           10/12
  Installing       : gcc-c++-8.3.1-5.el8.0.2.x86_64                       11/12
  Installing       : make-1:4.2.1-10.el8.x86_64                           12/12
  Running scriptlet: make-1:4.2.1-10.el8.x86_64                           12/12
  Verifying        : cpp-8.3.1-5.el8.0.2.x86_64                            1/12
  Verifying        : gcc-8.3.1-5.el8.0.2.x86_64                            2/12
  Verifying        : gcc-c++-8.3.1-5.el8.0.2.x86_64                        3/12
  Verifying        : isl-0.16.1-6.el8.x86_64                               4/12
  Verifying        : libmpc-1.0.2-9.el8.x86_64                             5/12
  Verifying        : libstdc++-devel-8.3.1-5.el8.0.2.x86_64                6/12
  Verifying        : binutils-2.30-73.el8.x86_64                           7/12
  Verifying        : glibc-devel-2.28-101.el8.x86_64                       8/12
  Verifying        : glibc-headers-2.28-101.el8.x86_64                     9/12
  Verifying        : kernel-headers-4.18.0-193.6.3.el8_2.x86_64           10/12
  Verifying        : libxcrypt-devel-4.1.1-4.el8.x86_64                   11/12
  Verifying        : make-1:4.2.1-10.el8.x86_64                           12/12
 
Installed:
  binutils-2.30-73.el8.x86_64        cpp-8.3.1-5.el8.0.2.x86_64
  gcc-8.3.1-5.el8.0.2.x86_64         gcc-c++-8.3.1-5.el8.0.2.x86_64
  glibc-devel-2.28-101.el8.x86_64    glibc-headers-2.28-101.el8.x86_64
  isl-0.16.1-6.el8.x86_64            kernel-headers-4.18.0-193.6.3.el8_2.x86_64
  libmpc-1.0.2-9.el8.x86_64          libstdc++-devel-8.3.1-5.el8.0.2.x86_64
  libxcrypt-devel-4.1.1-4.el8.x86_64 make-1:4.2.1-10.el8.x86_64
 
Complete!

Paso 4: descomprime todos los archivos .tar.gz

1
find . -type f -name '*.tar.gz' -exec tar -xzf {} \;

Paso 5: construye Lua

1
2
3
4
5
cd luajit*
make
make install
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.1

Resultado:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
dieciséis
17
18
19
20
21
22
23
24
25
26
27
28
[root@tutorialspots luajit2-2.1-20200102]# make
==== Building LuaJIT 2.1.0-beta3 ====
make -C src
make[1]: Entering directory '/usr/local/src/luajit2-2.1-20200102/src'
make[1]: Nothing to be done for 'default'.
make[1]: Leaving directory '/usr/local/src/luajit2-2.1-20200102/src'
==== Successfully built LuaJIT 2.1.0-beta3 ====
[root@tutorialspots luajit2-2.1-20200102]# make install
==== Installing LuaJIT 2.1.0-beta3 to /usr/local ====
mkdir -p /usr/local/bin /usr/local/lib /usr/local/include/luajit-2.1 /usr/local/share/man/man1 /usr/local/lib/pkgconfig /usr/local/share/luajit-2.1.0-beta3/jit /usr/local/share/lua/5.1 /usr/local/lib/lua/5.1
cd src && install -m 0755 luajit /usr/local/bin/luajit-2.1.0-beta3
cd src && test -f libluajit.a && install -m 0644 libluajit.a /usr/local/lib/libluajit-5.1.a || :
rm -f /usr/local/lib/libluajit-5.1.so.2.1.0 /usr/local/lib/libluajit-5.1.so /usr/local/lib/libluajit-5.1.so.2
cd src && test -f libluajit.so && \
  install -m 0755 libluajit.so /usr/local/lib/libluajit-5.1.so.2.1.0 && \
  ldconfig -n /usr/local/lib && \
  ln -sf libluajit-5.1.so.2.1.0 /usr/local/lib/libluajit-5.1.so && \
  ln -sf libluajit-5.1.so.2.1.0 /usr/local/lib/libluajit-5.1.so.2 || :
cd etc && install -m 0644 luajit.1 /usr/local/share/man/man1
cd etc && sed -e "s|^prefix=.*|prefix=/usr/local|" -e "s|^multilib=.*|multilib=lib|" luajit.pc > luajit.pc.tmp && \
  install -m 0644 luajit.pc.tmp /usr/local/lib/pkgconfig/luajit.pc && \
  rm -f luajit.pc.tmp
cd src && install -m 0644 lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h /usr/local/include/luajit-2.1
cd src/jit && install -m 0644 bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua dis_arm64be.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua dis_mips64.lua dis_mips64el.lua vmdef.lua /usr/local/share/luajit-2.1.0-beta3/jit
ln -sf luajit-2.1.0-beta3 /usr/local/bin/luajit
==== Successfully installed LuaJIT 2.1.0-beta3 to /usr/local ====
[root@tutorialspots luajit2-2.1-20200102]# export LUAJIT_LIB=/usr/local/lib
[root@tutorialspots luajit2-2.1-20200102]# export LUAJIT_INC=/usr/local/include/luajit-2.1

Paso 6: Instale Resty Core

1
2
cd ../lua-resty-core*
make install

Resultado:

1
2
3
4
5
6
7
8
9
[root@tutorialspots luajit2-2.1-20200102]# cd ../lua-resty-core*
[root@tutorialspots lua-resty-core-0.1.17]# make install
install -d /usr/local/lib/lua//resty/core/
install -d /usr/local/lib/lua//ngx/
install -d /usr/local/lib/lua//ngx/ssl
install lib/resty/*.lua /usr/local/lib/lua//resty/
install lib/resty/core/*.lua /usr/local/lib/lua//resty/core/
install lib/ngx/*.lua /usr/local/lib/lua//ngx/
install lib/ngx/ssl/*.lua /usr/local/lib/lua//ngx/ssl/

Paso 7: Instale Resty LRU Cache

1
2
cd ../lua-resty-lrucache*
make install

Resultado:

1
2
3
4
5
[root@tutorialspots lua-resty-core-0.1.17]# cd ../lua-resty-lrucache*
[root@tutorialspots lua-resty-lrucache-0.09]# make install
install -d //usr/local/lib/lua//resty/lrucache
install lib/resty/*.lua //usr/local/lib/lua//resty/
install lib/resty/lrucache/*.lua //usr/local/lib/lua//resty/lrucache/

Paso 8:

1
yum install -y pcre-devel zlib-devel openssl-devel

Resultado: