詳解在Centos 5.2下安裝最新Mysql Proxy LUA教程
在Centos 5.2下安裝***Mysql Proxy LUA教程是本文要介紹的內(nèi)容,主要是來了解Mysql Proxy LUA的安裝過程,文章中有很詳細(xì)的講解,具體內(nèi)容來看本文詳解。
mysql proxy的代碼樹已經(jīng)遷移到lauchpad,采用bazaar進(jìn)行版本管理。參考了一些文檔,在centos 5.2下編譯安裝***mysql proxy成功。步驟記錄如下(在centos 5下應(yīng)該也適用):
首先讓EPEL (Extra Packages for Enterprise Linux) repository 生效
- #rpm -Uvhhttp://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
確定這些包已經(jīng)安裝:GNU Autotools, flex, pkg-config, bazaar, MySQL client libraries
- yum install autoconf automake libtool flex pkgconfig bzr mysql-devel
centos下自帶的libevent版本超老,這個(gè)沒有別的辦法,只能自己重新編譯,版本需要在1.4.0以上,越高越好
- wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz
- tar zvfx libevent-1.4.9-stable.tar.gz
- cd libevent-1.4.9-stable
- /configure
- make
- make install
centos自帶的glib版本也比較老,mysql proxy 0.7.0以上需要glib2 2.16.0以上才能編譯成功,因此不得不重新編譯glib
- wget http://ftp.gnome.org/pub/gnome/sources/glib/2.18/glib-2.18.4.tar.gz
- tar zvfx glib-2.18.4.tar.gz
- cd glib-2.18.4
- /configure
- make
- make install
編譯安裝lua 5.1
- wget http://www.lua.org/ftp/lua-5.1.4.tar.gz
- tar zvfx lua-5.1.4.tar.gz
- cd lua-5.1.4
- vi src/Makefile
在CFLAGS里加上-fPIC,因?yàn)槲以?4位機(jī)上編譯出現(xiàn)了“relocations”錯(cuò)誤
- make linux
- make install
- cp etc/lua.pc /usr/local/lib/pkgconfig/
重要:讓pkg-config找到自己編譯的庫在哪里
- $exportPKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
***,從bazaar中檢出***的mysql-proxy源文件進(jìn)行編譯:
- bzr branch lp:mysql-proxy
- cd mysql-proxy
- /autogen.sh
提示錯(cuò)誤:
- configure.in:10: require Automake 1.10, but have 1.9
沒有找到解決方法
- /configure
- make
- make install
mysql-proxy安裝采用源碼安裝
- wget http://launchpad.net/mysql-proxy/0.8/0.8.0/+download/mysql-proxy-0.8.0.tar.gz
- tar zxvf mysql-proxy-0.8.0.tar.gz
- cd mysql-proxy-0.8.0
- /configure
- make
- make install
編譯完成,可以檢查一下最終結(jié)果:
- mysql-proxy -V
- mysql-proxy 0.8.0
- glib2: 2.18.4
- libevent: 2.0.10-stable
- lua: Lua 5.1.4
- LUA_PATH: /usr/local/lib/mysql-proxy/lua/?.lua
- LUA_CPATH: /usr/local/lib/mysql-proxy/lua/?.so
- == plugins ==
- admin: 0.7.0
- proxy: 0.7.0
配置啟動(dòng)腳本,在系統(tǒng)啟動(dòng)時(shí)運(yùn)行mysql-proxycd/etc/init.d
- wget http://customcode.googlecode.com/files/mysql-proxy
- chmod0755/etc/init.d/mysql-proxy
- chkconfig mysql-proxy on
增加運(yùn)行參數(shù)
- cat>/etc/sysconfig/mysql-proxyOptions to mysql-proxy
- do not remove --daemon
- PROXY_OPTIONS="--daemon"
CTRL+D保存,然后就可以使用以下命令啟動(dòng)|停止mysql-proxy
- /etc/init.d/mysql-proxy start|stop
錯(cuò)誤解決
1、
- /etc/init.d/mysql-proxy
- bash: /etc/init.d/mysql-proxy: /bin/bash^M: bad interpreter: No such file or directory
執(zhí)行一下任意一命令將mysql-proxy轉(zhuǎn)換為unxi格式
- #dos2unxi /etc/init.d/mysql-proxy
- #vi /etc/init.d/mysql-proxy
- set ff=unix
2、
- make[2]: *** [lua.o] Error 1
- make[2]: Leaving directory `/software/lua-5.1.4/src'
- make[1]: *** [linux] Error 2
- make[1]: Leaving directory `/software/lua-5.1.4/src'
- make: *** [linux] Error 2
解決:
- #yum -y install libtermcap-devel ncurses-devel ncurses-devel ncurses-devel
3、
- gconvert.c:55:2: error: #error GNU libiconv not in use but included iconv.h is from libiconv
小結(jié):詳解在Centos 5.2下安裝***Mysql Proxy LUA教程的內(nèi)容介紹完了,希望通過本文的學(xué)習(xí)能對(duì)你有所幫助!