Server environment for configuring LUA on CentOS (enet)

Source: Internet
Author: User
Tags lua

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.