Compile and install MySQL Proxy Lua 0.8.1 in Linux5u3

Source: Internet
Author: User

Linux5u3Compile and installMySQL Proxy0.8.1 is the content to be introduced in this article. It mainly records ENTERPRISELINUX5u3Compile and install the source code in a versionMySQL ProxyStep 0.8.

MySQL ProxyIs an application tool that provides connection between the MySQL server and the client through the MySQL network protocol. All MySQL-compatible clients (including mysql command lines, class libraries that call mysql command lines, and applications supporting MySQL network protocol) can be directly connected without any modificationsMysql Proxy.

1. Install the dependency package

Before installing MySQL Proxy through source code compilation, the following dependency packages must be installed first:

 
 
  1. Libevent 1.x or higher (1.3b or later is preferred)
  2. Lua 5.1.x or higher
  3. Glib2 2.16.0 or higher (the official document is 2.6.0 or later. during actual installation, mysql-proxy 0.8 prompts that it cannot be earlier than 2.16.0)
  4. Pkg-config
  5. Libtool 1.5 or higher
  6. MySQL 5.0.x or higher developer files

1) install libevent

The libevent version that comes with RHEL5.3 is earlier than version 1.1. If it does not meet your requirements, you can directly download the libevent version for installation. The procedure is as follows:

 
 
  1. # wget http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz  
  2. # tar xvfz libevent-1.4.14b-stable.tar.gz   
  3. # cd libevent-1.4.14b-stable   
  4. # ./configure --prefix=/usr/local/libevent-1.4   
  5. # make && make install  

2) install the lua Script Language Pack

Lua is a lightweight scripting language. MySQL Proxy expands its functions using this language.

Download the latest version 5.1.4 from the official website, decompress the package, and run the following commands:

 
 
  1. # wget http://www.lua.org/ftp/lua-5.1.4.tar.gz  
  2. # tar xvfz lua-5.1.4.tar.gz   
  3. # cd lua-5.1.4   
  4. # vi Makefile  

Modify the MakeFile file:

 
 
  1. INSTALL_TOP= /usr/local  

To:

 
 
  1. INSTALL_TOP= /usr/local/lua  

The purpose isLuaRelated files are stored in the same directory for easy searching and application.

LuaFor details about how to compile and INSTALL the SDK, see the INSTALL file in the directory. If you INSTALL the SDK in linux, run the following command to complete the compilation and installation:

 
 
  1. # make linux install  

3) install glib2

The official document says that version 2.6.0 or later is required. When mysql-proxy 0.8 is installed, the system prompts that the glib2 version cannot be earlier than 2.16.0. Here, to ensure smooth execution of the subsequent installation process, first upgrade glib2 of the system, the procedure is as follows.

 
 
  1. # wget http://ftp.gnome.org/pub/gnome/sources/glib/2.22/glib-2.22.5.tar.gz   
  2. # tar xvfz glib-2.22.5.tar.gz   
  3. # cd glib-2.22.5   
  4. # ./configure --prefix=/usr/local/glib-2.2   
  5. # make && make install  

4) install the MySQL Development Kit

Mysql_config and other applications are mainly needed. mysql Development kits can be downloaded directly from its official website:

 
 
  1. http://dev.mysql.com/downloads/mysql/5.1.html 

The Rpm package is easy to install. Run the following command:

 
 
  1. # rpm -ivh MySQL-devel-community-5.1.51-1.rhel5.x86_64.rpm  

2. InstallationMySQL Proxy

Next, it was the final turn of the main player. Here, we installed MySQL Proxy 0.8.1. You can also download it directly on its official website:

 
 
  1. http://dev.mysql.com/downloads/mysql-proxy/ 
 
 
  1. # tar xvfz mysql-proxy-0.8.1.tar.gz   
  2. # cd mysql-proxy-0.8.1   
  3. # ./configure LDFLAGS="-lm -ldl" LUA_CFLAGS="/usr/local/lua/bin/lua -I/usr/local/lua/include" 
  4. LUA_LIBS="/usr/local/lua/lib -llua" --prefix=/usr/local/mysql-proxy --with-lua   
  5. # make   
  6. # make install  

After the installation is successful, run the mysql-proxy command for verification:

 
 
  1. [root@rhel5u3 mysql-proxy]# /usr/local/mysql-proxy/bin/mysql-proxy -V   
  2. mysql-proxy 0.8.1   
  3. chassis: mysql-proxy 0.8.1   
  4. glib2: 2.22.5   
  5. libevent: 1.4.14b-stable   
  6. LUA: Lua 5.1.4   
  7. package.path: /usr/local/mysql-proxy/lib/mysql-proxy/lua/?.lua   
  8. package.cpath: /usr/local/mysql-proxy/lib/mysql-proxy/lua/?.so   
  9. modules   
  10. admin: 0.8.1   
  11. proxy: 0.8.1  

The compilation process looks simple, just a few commands, but this installation is not smooth, and I have been thinking about it for a whole day. Maybe it is my bad luck. Of course, it should be a little bit more, during the actual compilation process, many errors were encountered. For details about the error information and solution, I hope to help the same problem:

The operating system version is as follows:

 
 
  1. [root@rhel5u3 ~]# cat /etc/issue   
  2. Enterprise Linux Enterprise Linux Server release 5.3 (Carthage)   
  3. Kernel \r on an \m  

Error 1:

 
 
  1. checking for LUA... no   
  2. ... checked for Lua via pkg-config: No package ¨lua¨ found. retrying with lua5.1  

The error message indicates that the lua package cannot be found.

Solution:
1) As shown in Step 1.2, compile and installLua;

2) Set environment variables:

 
 
  1. export LUA_CFLAGS="-I/usr/local/lua/include"   
  2. export LUA_LIBS="-L/usr/local/lua/lib -llua -ldl"  

Note that the path in the variable should beLuaThe actual installation path, and then re-Execute configure configuration Compilation Program.

If the above operation fails, you can copy the etc/lua. pc file in the lua installation path to the lib/pkgconfig/folder in the glib2 installation path.

Error 2:

 
 
  1. checking for GLIB... configure: error: Package requirements (glib-2.0 >= 2.16.0) were not met:   
  2. Requested ¨glib-2.0 >= 2.16.0¨ but version of GLib is 2.12.3  

This indicates that the glib2 version identified by default is incorrect.

Solution:

1) Compile and install the appropriate glib according to Step 1.3;

2) Set environment variables:

 
 
  1. export GLIB_CFLAGS="-I/usr/local/glib-2.2/include/glib-2.0"   
  2. export GLIB_LIBS="-L/usr/local/glib-2.2/lib/glib-2.0"   
  3. export GMODULE_CFLAGS="-I/usr/local/glib-2.2/include"   
  4. export GMODULE_LIBS="-L/usr/local/glib-2.2/lib"   
  5. export GTHREAD_CFLAGS="-I/usr/local/glib-2.2/include"   
  6. export GTHREAD_LIBS="-L/usr/local/glib-2.2/lib"  

Specifically, GMODULE and GTHREAD variables must be set, otherwise errors such as (gmodule-2.0> = 2.16.0) were not met or (gthread-2.0> = 2.16.0) were not met may occur.

The path in the variable value should be the actual installation path of glib2, and then re-Execute configure configuration Compilation Program.

Error 3:

 
 
  1. checking for event_init in -levent... no   
  2. configure: error: libevent is required  

The libevent dependency package is not found.

Solution:

1) Compile and install libevent as shown in Step 1.1.

2) Set environment variables:

 
 
  1. export LDFLAGS="-L/usr/local/libevent-1.4/lib -lm"  

Then execute configure configuration and compile the program again.

Error 4:

 
 
  1. /usr/local/lua/lib/liblua.a: could not read symbols: Bad value  

It seems that a lua call error occurs. The related documentation prompts that the 64bit environment may encounter this phenomenon.

Solution:

A>. Edit the src/MakeFile file of lua and modify the following parameters:

 
 
  1. CFLAGS= -O2 -Wall $(MYCFLAGS)  

To:

 
 
  1. CFLAGS= -O2 -Wall -fPIC $(MYCFLAGS)  

B>. Compile and install the SDK as shown in Step 1.2.Lua. If you have already compiled the configuration, run make clean to clear the compiled configuration.

Error 5:

 
 
  1. /usr/local/glib-2.22/include/glib-2.0/glib/gtypes.h:34:24: error: glibconfig.h: No such file or directory  

Solution:

 
 
  1. # cp /usr/local/glib-2.2/lib/glib-2.0/include/glibconfig.h /usr/local/glib-2.2/include/glib-2.0/  

Then re-execute the compilation.

Summary:Linux5u3Compile and installMySQL Proxy0.8.1 has been introduced. I hope this article will help you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.