openresty安装
安装openresty
如果少包请先安装依赖包一般少的是pcre 和ssl
# yum install openssl-devel pcre-devel -y
# cd ngx_openresty-1.5.12.1
# CFLAGS=-fPIC ./configure
# gmake
# gmake install
这样就默认安装在了/usr/local/openresty/下面
安装luasocket-2.0.2
# cd luasocket-2.0.2
# vim config
将下列几行改为自己安装的luajit的目录
#LUAINC=-I/usr/local/include/lua5.1
LUAINC=-I/usr/local/openresty/luajit/include/luajit-2.1 最好复制一行再取消掉注释
# make
# make install
安装 lua-cjson-2.1.0
# cd lua-cjson-2.1.0
# vim Makefile
将下列行改为需要的目录路径
PREFIX = /usr/local/openresty/luajit
#CFLAGS = -g -Wall -pedantic -fno-inline
CFLAGS = -O3 -Wall -pedantic -DNDEBUG
CJSON_CFLAGS = -fpic
CJSON_LDFLAGS = -shared
LUA_INCLUDE_DIR = $(PREFIX)/include/luajit-2.1
LUA_CMODULE_DIR = $(PREFIX)/lib/lua/$(LUA_VERSION)
LUA_MODULE_DIR = $(PREFIX)/share/lua/$(LUA_VERSION)
# make
# make install
/usr/local/openresty/luajit/lib/lua/5.1/cjson.so 这个动态库就有了
安装 luajava-1.1
# cd luajava-1.1
# vim config
将下列行改为自己安装的路径:
#Linux/BSD/Mac
LUA_DIR= /usr/local/openresty/luajit
LUA_LIBDIR= /usr/local/openresty/luajit/lib
LUA_INCLUDES= /usr/local/openresty/luajit/include/luajit-2.1
JDK= $(JAVA_HOME)
# For Mac OS, comment the above line and uncomment this one
#JDK=/Library/Java/Home
# Full path to Lua static library
LIB_LUA=$(LUA_LIBDIR)/libluajit-5.1.a
# make
make前要保证java环境变量已经配好
将编译好的libluajava-1.1.so拷贝到$JAVA_HOME\jre\bin目录,luajava-1.1.jar拷贝到$JAVA_HOME\jre\lib\ext目录
JAVA 环境安装
# tar xf jdk-7u51-linux-x64.tar.gz -C /usr/local/
# vim /etc/profile
加上下面的两行
export JAVA_HOME=/usr/local/jdk1.7.0_51
export PATH=$PATH:$JAVA_HOME/bin
# source /etc/profile # 让环境变量生效