`
Uncle.Code
  • 浏览: 46599 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

centos 7 下搭建lua + luarocks 环境

阅读更多

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

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
> 

7、更精细内容查看下文,周同学的文章
http://segmentfault.com/a/1190000003920034
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics