1、安装依赖环境
- # 需要管理员权限
- yum install readline-dev readline-devel
- curl -R -O http://www.lua.org/ftp/lua-5.3.3.tar.gz
- tar zxf lua-5.3.3.tar.gz
- cd lua-5.3.3
- make linux test
- sudo make install
2、Luarocks安装
- $ wget http://luarocks.org/releases/luarocks-2.4.1.tar.gz
- $ tar zxpf luarocks-2.4.1.tar.gz
- $ cd luarocks-2.4.1
- $ ./configure; sudo make bootstrap
- # 或者 make build && make install
3、测试
- sudo luarocks install luasocket
- # luarocks install luasocket --local
- luarocks install luautf8
- #local utf8 = require 'lua-utf8'
4、错误处理,如找不到MySQLDIR
- [root@localhost ~]# luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql/mysql
- Installing https://luarocks.org/luasql-mysql-2.6.0-1.rockspec
- Error: Could not find header file for MYSQL
- No file mysql.h in /usr/include/mysql/mysql
- You may have to install MYSQL in your system and/or pass MYSQL_DIR or MYSQL_INCDIR to the luarocks command.
- Example: luarocks install luasql-mysql MYSQL_DIR=/usr/local
- 指定DIR:
- luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql
5、错误处理、不能克隆
- Installing https://luarocks.org/luasql-mysql-2.6.0-1.rockspec
- 正克隆到 'luasql'...
- fatal: remote error:
- The unauthenticated git protocol on port 9418 is no longer supported.
- Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
- Error: Failed cloning git repository.
- 本地源码安装:
- 下载并解压luasql-master
- luarocks make rockspec/luasql-mysql-2.6.0-1.rockspec MYSQL_INCDIR=/usr/include/mysql
6、找不到mysqlclient
- [root@localhost luasql-master]# locate mysqlclient (具体看libmysqlclient真实地址)
- /usr/lib64/mysql/libmysqlclient.so.18
- /usr/lib64/mysql/libmysqlclient.so.18.0.0
- [root@localhost luasql-master]#
- [root@localhost luasql-master]#
- [root@localhost luasql-master]#
- [root@localhost mysql]# ln -s /usr/lib64/mysql/libmysqlclient.so /usr/local/lib/libmysqlclient.so
- [root@localhost mysql]# ln -s /usr/lib64/mysql/libmysqlclient.so.20 /usr/local/lib/libmysqlclient.so.20
发表评论