Installing LUA & Luarocket
Installation dependencies
yum install gcc gcc-c++ kernel-devel yum install readline-dev yum install ncurses-devel.i386
Download and compile Lua source files
wget http://www.lua.org/ftp/lua-5.1.4.tar.gz tar zxvf lua-5.1.4.tar.gz cd lua-5.1.4 make linux
Download and install Luarocks
wget http://luarocks.org/releases/luarocks-2.0.6.tar.gz tar zxvf luarocks-2.0.6.tar.gz cd luarocks-2.0.6 ./configure make make install
Installing Enet && Lua enet
Download and compile Enet
wgettar zxvf enet-1.3.13.tar.gz cd enet-1.3.13 ./configure make make install
Download and install Lua enet
luarocks install enet
Test it.
lua>require"enet"
If you don't have an error, it's okay.
I encountered two errors, the first time I did not find enet.so, this is because LUA did not find it in the set path range, set the next Lua_cpath, this value can be viewed by the luarocks path
exportLUA_CPATH=‘/usr/lib/lua/5.1//?.so;/usr/.luarocks/lib/lua/5.1//?.so;./?.so;/usr/lib/lua/5.1/?.so;/usr/lib/lua/5.1/loadall.so‘
The second time is loaded enet.so did not find libenet.so.7, this is because the dynamic link library so in the path range did not find it, set the next Ld_library_path, with the find / -name libenent.so.7
view file where
libenet.so.7: cannot open shared object file: No such file or directory
exportLD_LIBRARY_PATH=/home/tangyikejun/lib:$LD_LIBRARY_PATH
Beginning Port
iptables
Write an example to test the connection, I did not succeed in writing the first time, using NC to test the connection
Service side
nc -l 1111
Client
nc 34.55.44.222 1111
If connected, the client input haha, the server will also receive haha
Reference:
CentOS Installation Lua
So file how to find paths
Server environment for configuring LUA on CentOS (enet)