Thursday 3 July 2014

How to install Luarocks from sources in Debian


In this article we are going to install luarocks software in a Debian box.


Luarocks is a system to manage and deploy lua modules ("rocks").

It also tracks and installs needed dependencies when installing a new lua rock.

luarocks.org official web site.


Install lua


First we need lua scripting language to be installed. (I get lua 5.2 version)

$ sudo aptitude install lua5.2


Lua development files will also be necessary to compile sources afterwards.

$ sudo aptitude install liblua5.2-dev


Get and compile luarocks source code


Get luarocks source code

(Current version was 2.0.13 when writing this article)
$ wget luarocks.org/releases/luarocks-2.0.13.tar.gz

$ tar xvzf luarocks-2.0.13.tar.gz

$ cd luarocks-2.0.13/


Build the sources.

$ ./configure

or to select a specific lua version:
$ ./configure --lua-version=5.2 # Use specific Lua version: 5.1 or 5.2. Default is "5.1"

$ make

$ sudo make install


Execute luarocks

If /usr/local/bin is not set in PATH env variable.
$ export PATH=$PATH:/usr/local/bin


Show help

General help:
$ luarocks
$ luarocks help

Shows help about list command.
$ luarocks help list


List currently installed rocks:
$ luarocks list

Installed rocks:
----------------

luasec
   0.4-4 (installed) - /usr/local/lib/luarocks/rocks

luasocket
   2.0.2-5 (installed) - /usr/local/lib/luarocks/rocks

sha2
   0.2.0-1 (installed) - /usr/local/lib/luarocks/rocks

Search among available rocks:
$ luarocks search socket

Install a rock in global system tree:
$ sudo luarocks install luasocket

or in a local tree:
$ luarocks --local install luasocket

Show info about an installed rock:
$ luarocks show luasocket

LuaSocket 3.0rc1-1 - Network support for the Lua language

LuaSocket is a Lua extension library that is composed by two parts: a C core
that provides support for the TCP and UDP transport layers, and a set of Lua
modules that add support for functionality commonly needed by applications that
deal with the Internet.

License:  MIT
Homepage:  http://luaforge.net/projects/luasocket/
Installed in:  /usr/local

Modules:
 ltn12 (/usr/local/share/lua/5.2/ltn12.lua)
 mime (/usr/local/share/lua/5.2/mime.lua)
 mime.core (/usr/local/lib/lua/5.2/mime/core.so)
 socket (/usr/local/share/lua/5.2/socket.lua)
 socket.core (/usr/local/lib/lua/5.2/socket/core.so)
 socket.ftp (/usr/local/share/lua/5.2/socket/ftp.lua)
 socket.headers (/usr/local/share/lua/5.2/socket/headers.lua)
 socket.http (/usr/local/share/lua/5.2/socket/http.lua)
 socket.serial (/usr/local/lib/lua/5.2/socket/serial.so)
 socket.smtp (/usr/local/share/lua/5.2/socket/smtp.lua)
 socket.tp (/usr/local/share/lua/5.2/socket/tp.lua)
 socket.unix (/usr/local/lib/lua/5.2/socket/unix.so)
 socket.url (/usr/local/share/lua/5.2/socket/url.lua)

Remove an installed rock:
$ sudo luarocks remove luasocket


Reference


http://luarocks.org

http://luarocks.org/en/Documentation

http://luarocks.org/en/Using_LuaRocks

http://luarocks.org/en/Installation_instructions_for_Unix

0 comentarios: