centos6.4最小系统
安装编译环境:yum -y groupinstall "Development tools" "Server Platform Development"
由于mysql-proxy是基于lua脚本的,所以安装mysql-proxy之前得先安装lua,这里是编译安装
lua-5.1.5.tar.gz
工具都放在/root目录下
cd /root
tar xf lua-5.1.5.tar.gz
cd lua-5.1.5
[[email protected] lua-5.1.5]# ls
COPYRIGHT doc etc HISTORY INSTALL Makefile README src test
[[email protected] lua-5.1.5]# vi Makefile
将INSTALL_TOP= /usr/local/替换为
INSTALL_TOP= /usr/local/lua
[[email protected] lua-5.1.5]# cd src/
[[email protected] src]# vi Makefile
将CFLAGS= -O2 -Wall $(MYCFLAGS)替换为
CFLAGS= -O2 -Wall -fPIC $(MYCFLAGS)不然会报错(查资料说是基于64位系统)
cd /root/lua-5.1.5
make linux install
由于lua编译的时候回依赖于readline,所以须得安装readline
yum -y install readline readline-devel
安装完之后就继续安装lua,最后可以成功了
##################################################################
接下来编译安装mysql-proxy-0.8.3.tar.gz
cd /root
tar xf mysql-proxy-0.8.3.tar.gz
cd mysql-proxy-0.8.3
./configure LDFLAGS="-lm -ldl" LUA_CFLAGS="/usr/local/lua/bin/lua -I/usr/local/lua/include" LUA_LIBS="/usr/local/lua/lib -llua" --with-mysql=/usr/local/mysql/bin/mysql_config --prefix=/usr/local/mysql-proxy
编译的时候会出错:依赖于libevent,glib
yum -y install libevent libevent-devel glib*
继续编译,成功之后
make
当进行到一段时间后,又会出现错误,根据错误提示继续安装libtool*
然后继续安装
说是找不到库文件,然后在/usr/lib64下有找到lua-5.1.so的文件,于是查资料可能是另外一种原因devel包的可能
yum -y install lua-devel
执行之后再次make,终于成功了,最后make install
[[email protected] mysql-proxy-0.8.3]# /usr/local/mysql-proxy/bin/mysql-proxy -V
mysql-proxy 0.8.3
chassis: mysql-proxy 0.8.3
glib2: 2.28.8
libevent: 1.4.13-stable
LUA: Lua 5.1.5
package.path: /usr/local/mysql-proxy/lib/mysql-proxy/lua/?.lua
package.cpath: /usr/local/mysql-proxy/lib/mysql-proxy/lua/?.so
-- modules
proxy: 0.8.3
至此,mysql-proxy编译安装成功,其中的依赖关系真的要自己好好摸索
mysql-proxy的一些配置,以及启动脚本参考如下:
http://heylinux.com/archives/1004.html