# 【Lua】安裝 luarocks

[https://github.com/luarocks/luarocks/wiki/Download](https://github.com/luarocks/luarocks/wiki/Download)

[https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix](https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix)

```shell
apt-get update
apt install build-essential libreadline-dev unzip wget zlib1g-dev -y

#安裝 luarocks
wget https://luarocks.org/releases/luarocks-3.8.0.tar.gz && tar zxpf luarocks-3.8.0.tar.gz && cd luarocks-3.8.0 
./configure 
make && make install

#安裝 lua-resty-http
luarocks install lua-resty-http
#安裝 lua-ffi-zlib
luarocks install lua-ffi-zlib
```

### install lua-zlib

<div id="bkmrk-https%3A%2F%2Fblog.51cto.c">[https://blog.51cto.com/u\_5650011/5394910](https://blog.51cto.com/u_5650011/5394910)</div><div id="bkmrk-"></div>```
cd /usr/local
wget https://github.com/brimworks/lua-zlib/archive/master.zip
unzip lua-zlib-master.zip
```

```
cd /usr/local/lua-zlib-master
cmake -DLUA_INCLUDE_DIR=/usr/local/openresty/luajit/include/luajit-2.1 -DLUA_LIBRARIES=/usr/local/openresty/luajit/lib -DUSE_LUAJIT=ON -DUSE_LUA=OFF
```

```
make
cp zlib.so /usr/local/openresty/lualib/zlib.so
```