文章目录

不积跬步无以至千里

记录精彩的程序人生

centos 7 下搭建lua + luarocks 环境 有更新!

  aluaa

     

    废话不多说,客官往下看。

    1、安装依赖

    $ yum install gcc gcc-c++ kernel-devel
    $ yum install readline-dev
    $ yum install ncurses-devel.i386
    

    2、安装lua

    $ wget http://www.lua.org/ftp/lua-5.1.5.tar.gz
    $ tar zxvf lua-5.1.5.tar.gz
    $ cd lua-5.1.5
    $ vi Makefile
    INSTALL_TOP= /usr/local/lua-5.1.5
    

    $ make linux
    $ make install

    3、安装luarocks

    $ wget http://keplerproject.github.io/luarocks/releases/luarocks-2.2.2.tar.gz
    $ tar -xzvf luarocks-2.2.2.tar.gz
    $ cd luarocks-2.2.2
    $ ./configure --prefix=/usr/local/luarocks-2.2.2 --with-lua=/usr/local/lua-5.1.5
    $ make build
    $ make install
    

    4、配置环境变量

    PATH=$PATH:$HOME/bin:/usr/local/luarocks-2.2.2/bin:/usr/local/lua-5.1.5/bin
    

    export PATH

    export LUA_PATH=“/usr/local/luarocks-2.2.2/share/lua/5.1/?.lua;?.lua;;”
    export LUA_CPATH=“/usr/local/luarocks-2.2.2/lib/lua/5.1/?.so;?.so;;”

    5、安装luasocket

    $ luarocks install luasocket
    

    6、测试

    [root@ball-2 5.1]# lua
    Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
    > require "socket"
    > print(socket)
    table: 0xb57400
    >
    
    转自:http://www.chongchonggou.com/g_401620246.html
    validate