CentOs 安装lua,luasocket

前端之家收集整理的这篇文章主要介绍了CentOs 安装lua,luasocket前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

一、centos安装Lua

1)lua的官网:http://www.lua.org

2)lua的所有版本:http://www.lua.org/versions.html

3)个人在这里选择使用5.1版本的

*下载

[plain] view plain copy
  1. wgethttp://www.lua.org/ftp/lua-5.1.5.tar.gz
  2. --2013-10-1416:23:17--http://www.lua.org/ftp/lua-5.1.5.tar.gz
  3. Resolvingwww.lua.org...89.238.129.35,2a02:40:41::5
  4. Connectingtowww.lua.org|89.238.129.35|:80...connected.
  5. HTTPrequestsent,awaitingresponse...200OK
  6. Length:221213(216K)[application/octet-stream]
  7. Savingto:“lua-5.1.5.tar.gz”
*解压文件

copy

    tar-xzvflua-5.1.5.tar.gz

*安装

copy

    [root@xxxlua-5.1.5]#make
  1. Pleasedo
  2. makePLATFORM
  3. wherePLATFORMisoneofthese:
  4. aixansibsdfreebsdgenericlinuxmacosxmingwposixsolaris
  5. SeeINSTALLforcompleteinstructions.
提示输入 参数指定安装的系统平台

copy

    [root@xxxlua-5.1.5]#makelinux
  1. cdsrc&&makelinux
  2. make[1]:Enteringdirectory`/root/down/lua-5.1.5/src'
  3. makeallMYCFLAGS=-DLUA_USE_LINUXMYLIBS="-Wl,-E-ldl-lreadline-lhistory-lncurses"
  4. make[2]:Enteringdirectory`/root/down/lua-5.1.5/src'
  5. gcc-O2-Wall-DLUA_USE_LINUX-c-olua.olua.c
  6. Infileincludedfromlua.h:16,
  7. fromlua.c:15:
  8. luaconf.h:275:31:error:readline/readline.h:Nosuchfileordirectory
  9. luaconf.h:276:30:error:readline/history.h:Nosuchfileordirectory
  10. lua.c:Infunction‘pushline’:
  11. lua.c:182:warning:implicitdeclarationoffunction‘readline’
  12. lua.c:182:warning:assignmentmakespointerfromintegerwithoutacast
  13. lua.c:Infunction‘loadline’:
  14. lua.c:210:warning:implicitdeclarationoffunction‘add_history’
  15. make[2]:***[lua.o]Error1
  16. make[2]:Leavingdirectory`/root/down/lua-5.1.5/src'
  17. make[1]:***[linux]Error2
  18. make[1]:Leavingdirectory`/root/down/lua-5.1.5/src'
  19. make:***[linux]Error2

这里又报了个错,百度了一下,未安装一些必须的开发环境

copy

    yuminstall-yreadline-develncurses-devel

执行一下上边的安装

然后继续lua的安装

copy

    gcc-olualua.oliblua.a-lm-Wl,-E-ldl-lreadline-lhistory-lncurses
  1. gcc-O2-Wall-DLUA_USE_LINUX-c-oluac.oluac.c
  2. gcc-O2-Wall-DLUA_USE_LINUX-c-oprint.oprint.c
  3. gcc-oluacluac.oprint.oliblua.a-lm-Wl,-E-ldl-lreadline-lhistory-lncurses
  4. make[1]:Leavingdirectory`/root/down/lua-5.1.5/src'
下一步:

copy

    [root@xxxlua-5.1.5]#makeinstall
  1. cdsrc&&mkdir-p/usr/local/bin/usr/local/include/usr/local/lib/usr/local/man/man1/usr/local/share/lua/5.1/usr/local/lib/lua/5.1
  2. cdsrc&&install-p-m0755lualuac/usr/local/bin
  3. cdsrc&&install-p-m0644lua.hluaconf.hlualib.hlauxlib.h../etc/lua.hpp/usr/local/include
  4. cdsrc&&install-p-m0644liblua.a/usr/local/lib
  5. cddoc&&install-p-m0644lua.1luac.1/usr/local/man/man1

如此安装完成,然后试一下效果

copy

    [root@xxxlua-5.1.5]#lua
  1. Lua5.1.5Copyright(C)1994-2012Lua.org,PUC-Rio
  2. >print("Hello");
  3. Hello
  4. >

二、centos安装LuaSocket

1) LuaSocket源码地址:http://files.luaforge.net/releases/luasocket/luasocket

2)个人选择:http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2

3)下载并解压

copy

    wgethttp://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2/luasocket-2.0.2.tar.gz
  1. tar-xzvfluasocket-2.0.2.tar.gz

4)安装

copy

    [root@xxxluasocket-2.0.2]#make&makeinstall
  1. [1]2109
  2. cdsrc;makeall
  3. cdsrc;makeall
  4. make[1]:Enteringdirectory`/root/down/luasocket-2.0.2/src'
  5. make[1]:Nothingtobedonefor`all'.
  6. make[1]:Leavingdirectory`/root/down/luasocket-2.0.2/src'
  7. make[1]:Enteringdirectory`/root/down/luasocket-2.0.2/src'
  8. make[1]:Nothingtobedonefor`all'.
  9. make[1]:Leavingdirectory`/root/down/luasocket-2.0.2/src'
  10. cdsrc;mkdir-p/usr/local/share/lua/5.1
  11. cdsrc;cpltn12.luasocket.luamime.lua/usr/local/share/lua/5.1
  12. cdsrc;mkdir-p/usr/local/share/lua/5.1/socket
  13. cdsrc;cphttp.luaurl.luatp.luaftp.luasmtp.lua/usr/local/share/lua/5.1/socket
  14. cdsrc;mkdir-p/usr/local/lib/lua/5.1/socket
  15. cdsrc;cpsocket.so.2.0.2/usr/local/lib/lua/5.1/socket/core.so
  16. #cdsrc;mkdir-p/usr/local/share/lua/5.1/mime
  17. #cdsrc;cp/usr/local/share/lua/5.1/mime
  18. cdsrc;mkdir-p/usr/local/lib/lua/5.1/mime
  19. cdsrc;cpmime.so.1.0.2/usr/local/lib/lua/5.1/mime/core.so
  20. [1]+Donemake
5)个人在这里顺利安装成功,哈哈 原文链接:https://www.f2er.com/centos/377960.html

猜你在找的CentOS相关文章