美文网首页
linux上为OpenResty安装luarocks和lua-l

linux上为OpenResty安装luarocks和lua-l

作者: 吃瓜的东 | 来源:发表于2017-09-07 11:33 被阅读0次

    1.首先要安装luarocks

    # 先检查下是否已经安装了
    luarocks --version
    

    安装步骤:

    wget --no-check-certificate https://luarocks.org/releases/luarocks-2.4.1.tar.gz
    
    tar -xzvf luarocks-2.4.1.tar.gz
    
    cd luarocks-2.4.1/
     
    ./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 build
    # 安装需要root权限
    sudo make install
     
    

    注意命令的openresty路径、名称什么的可能和实际机器上的不一样,要以实际的为准。

    说明和注意:

    --prefix 设定 luarocks 的安装目录

    --with-lua 则是系统中安装的 lua 的根目录

    --lua-suffix 版本后缀,此处因为openresytlua解释器使用的是 luajit ,所以此处得写 jit

    --with-lua-include 设置 lua 引入一些头文件头文件的目录

    之后我们就可以看到 luarocks 命令就被安装在了 /usr/local/openresty/luajit/bin 下面

    然后我们把它添加到到 PATH 中
    vi ~/.bash_profile

    export PATH=$PATH:/usr/local/openresty/luajit/bin
    

    执行 luarocks install package 就可以安装lua的包了

    luarocks install package --tree=path 还可以指定你安装的包的存放路径

    2.用luarocks安装lz4

    sudo luarocks install lua-lz4
    

    或者:

    cd /usr/local/openresty/luajit/bin/
    sudo ./luarocks install lua-lz4
    

    安装完毕,OK了。

    相关文章

      网友评论

          本文标题:linux上为OpenResty安装luarocks和lua-l

          本文链接:https://www.haomeiwen.com/subject/tkfijxtx.html