luarocks quickstart
<p>Here is the <a href="https://luarocks.org/" target="_blank" rel="external noopener noreferrer">official website of LuaRocks</a>. LuaRocks is the package manager for Lua moduels, which means that we can use it to install or uninstall some specific Lua libraries like LuaMySQL and LuaMongoDB.</p>
Below is the tutorial to install LuaRocks.
Install LuaRocks
Here we use Centos 7. We will install LuaRocks through command lines as follows (Here is official tutorial):
1 | wget https://luarocks.org/releases/luarocks-2.4.1.tar.gz |
Now execute this command:
1 | luarocks |
If everythings goes well, we can similar output as below:
1 |
|
Install LuaSocket
Now we will try to install LuaSocket through LuaRocks. Note that we may need to use sudo command but luarocks may not be identified by sudo. In that case, we can use root user to execute luarocks command:
1 | su root |
To check that luasocket whether is installed successfully or not, we can enter lua shell and type:
1 | require "socket" |
The output returned by command should be similar as follows:
1 | > require "socket" |
</div>
<footer>
<div class="alignright">
<a href="javascript:void(0)" class="share-link bdsharebuttonbox" data-cmd="more">Share</a>
</div>
<div class="clearfix"></div>
</footer>