备注:
此次安装使用的是openresty 的openresty-1.11.2.1(openresty-1.11.2.1.tar.gz,最新版本存在cjson 包的问题 )
同时对于luarocks 使用源码安装(使用yum 会有包的问题,解决起来少为费事点,实际上通过配置环境变量
也可以解决,就是费事,同时容易遗漏)
1. openresty 安装(需要的依赖按照提示安装即可)
wget https://openresty.org/download/openresty-1.11.2.1.tar.gz
tar zxvf openresty-1.11.2.1.tar.gz
cd openresty-1.11.2.1
./configure
gmake && gmake install
2. luarocks(源码)
wget https://luarocks.github.io/luarocks/releases/luarocks-2.4.3.tar.gz
tar -xzvf luarocks-2.4.3.tar.gz
cd luarocks-2.4.3
./configure --prefix=/usr/local/openresty/luajit
--with-lua=/usr/local/openresty/luajit/
--lua-suffix=jit
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1
make
sudo make install
3. lapis&&moonscript安装(lua 编译)
/usr/local/openresty/luajit/luarocks install moonscript
/usr/local/openresty/luajit/luarocks install lapis
4. 工具环境变量配置
ln -s /usr/local/openresty/luajit/bin/luarocks /usr/bin/luarocks
ln -s /usr/local/openresty/luajit/bin/lapis /usr/bin/lapis
ln -s /usr/local/openresty/luajit/bin/moonc /usr/bin/moonc
ln -s /usr/local/openresty/luajit/bin/moon /usr/bin/moon
5. lapis 使用
// 目前站点放在 /usr/local/openresty/site/lualib 可以自定义
// create projeect
lapis new --lua (默认为moonscript 最好使用moonc 进行实时编译)
lapis server
6. 效果
7. 参考资料
http://moonscript.org/ http://leafo.net/lapis/reference/lua_getting_started.html https://openresty.org/en/using-luarocks.html https://openresty.org/en/download.html#source-code-releases