Jump to content
Science Forums

Installing MySQL-Proxy and Asterisk (1.6.2.0-rc3) from source on CentOS 5.3


alexander

Recommended Posts

One really needs to know what they are doing for this, but i just need a place to put this so i can reference it in the future... And i am sure there are other people who will find this useful ;)

 

Ok firstly lets install all the dependencies: for mysql-proxy and lua

for x86_64

# yum install gcc.x86_64 libevent.x86_64 libevent-devel.x86_64 readline.x86_64 readline-devel.x86_64 ncurses.x86_64 ncurses-devel.x86_64 glib2.x86_64 glib2-devel.x86_64 mysql-devel.x86_64

 

for i386

# yum install gcc libevent libevent-devel readline readline-devel ncurses ncurses-devel glib2 glib2-devel mysql-devel

 

cd /usr/local/src/

 

these are the last versions of these packages that dont depend on the newer libc

 

# wget http://www.lua.org/ftp/lua-5.1.4.tar.gz

# wget http://dev.mysql.com/get/Downloads/MySQL-Proxy/mysql-proxy-0.6.1.tar.gz/from/http://www.mirrorservice.org/sites/ftp.mysql.com/

 

untar everything:

# tar xvzf lua-5.1.4.tar.gz

# tar xvzf mysql-proxy-0.6.1.tar.gz

and install lua

# cd lua-5.1.4

# make linux

# make install

then mysql-proxy

# cd ../mysql-proxy-0.6.1

# ./configure LDFLAGS="-lm -ldl" LUA_CFLAGS="-I/usr/local/include/" LUA_LIBS=/usr/local/lib/liblua.a

# make

# make install

make a couple of directories needed for proper operation of mysql-proxy

# mkdir /var/log/mysql-proxy/

# mkdir -p /usr/local/mysql/lua-scripts/

finally lets create an init script to start this sucker up (please notice and edit the PROXY_OPTIONS )

 

/etc/init.d/mysql-proxy

#!/bin/sh
#
# mysql-proxy This script starts and stops the mysql-proxy daemon
#
# chkconfig: - 78 30
# processname: mysql-proxy
# description: mysql-proxy is a proxy daemon to mysql

# Source function library.
. /etc/rc.d/init.d/functions

PROXY_PATH=/usr/local/sbin/

prog="mysql-proxy"

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Set default mysql-proxy configuration.
PROXY_OPTIONS="--daemon --proxy-backend-addresses=1.2.3.4:3306 --proxy-backend-addresses=1.2.3.4:3306"
PROXY_PID=/var/run/mysql-proxy.pid

# Source mysql-proxy configuration.
if [ -f /etc/sysconfig/mysql-proxy ] ; then
       . /etc/sysconfig/mysql-proxy
fi

PATH=$PATH:/usr/bin:/usr/local/bin:$PROXY_PATH

# By default its all good
RETVAL=0

# See how we were called.
case "$1" in
 start)
       # Start daemon.
       echo -n $"Starting $prog: "
       daemon $NICELEVEL $PROXY_PATH/mysql-proxy $PROXY_OPTIONS --pid-file $PROXY_PID
       RETVAL=$?
       echo
       if [ $RETVAL = 0 ]; then
               touch /var/lock/subsys/mysql-proxy
       fi
       ;;
 stop)
       # Stop daemons.
       echo -n $"Stopping $prog: "
       killproc $prog
       RETVAL=$?
       echo
       if [ $RETVAL = 0 ]; then
               rm -f /var/lock/subsys/mysql-proxy
               rm -f $PROXY_PID
       fi
       ;;
 restart)
       $0 stop
       sleep 3
       $0 start
       ;;
 condrestart)
      [ -e /var/lock/subsys/mysql-proxy ] && $0 restart
      ;;
 status)
       status mysql-proxy
       RETVAL=$?
       ;;
 *)
       echo "Usage: $0 {start|stop|restart|status|condrestart}"
       RETVAL=1
       ;;
esac

exit $RETVAL

 

Now lets fight asterisk

 

Install pre-requisites ;)

 

# yum install gcc gcc-c++ kernel-devel bison openssl openssl-devel perl perl-Net-SSLeay perl-Crypt-SSLeay libtermcap-devel ncurses-devel doxygen curl-devel newt-devel mlocate lynx tar wget nmap bzip2 mod_ssl crontabs vixie-cron speex speex-devel unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel mysql-connector-odbc mysql mysql-devel mysql-server php-mysql php-mbstring php-mcrypt flex screen bzip2 mlocate vixie-cron tar wget mysql-connector-odbc libxml2-devel libidn-devel krb5-devel krb5-libs zlib-devel libidn-devel

 

If we are running 64, please link these (its just easier that way)

# ln -sf /usr/lib64/libcom_err.so.2 /usr/lib64/libcom_err.so

 

Also lets create a /usr/src/linux link (not necessary, but i have it for good measure)

# ln -s /usr/src/kernels/2.6.18-164.el5-x86_64/ /usr/src/linux

 

now lets get everything we need (note these are prone to changing in the future, check for latest versions)

# wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz

# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.6.2.0-rc3.tar.gz

# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-addons-1.6.2.0-rc1.tar.gz

 

now then, extract everything

# tar xvzf asterisk-1.6.2.0-rc3.tar.gz

# tar xvzf asterisk-addons-1.6.2.0-rc1.tar.gz

# tar xvzf dahdi-linux-complete-current.tar.gz

 

# cd dahdi-linux-complete-2.2.0.2+2.2.0

# make all

 

if it screams at linux sources, check that your uname -r is the same as the kernel source version in /usr/src/kernels, reboot if different

 

# make config

# chkconfig dahdi on

# /etc/init.d/dahdi start

 

moving on now lets go into asterisk

# cd ../asterisk-1.6.2.0-rc3

 

first lets make a quick fix (it may be in the newer version that you might be using, just check)

# cat apps/app_queue.c | grep 'if (!strcasecmp(m->rt_uniqueid, rt_uniqueid))'

 

if that returns a result, you need to edit that line, it should read

if (strcasecmp(m->rt_uniqueid, rt_uniqueid))

 

save, exit, lets run into our first MAJOR problem :D

# ./configure

 

i wont go over how i configure asterisk for our environment, but you would do that using

# make menuselect

# make

 

and you will get something like this:

   [LD] pbx_lua.o -> pbx_lua.so
/usr/bin/ld: /usr/local/lib/liblua.a(lapi.o): relocation R_X86_64_32 against `luaO_nilobject_' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/liblua.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [pbx_lua.so] Error 1
make: *** [pbx] Error 2

 

lets go fix this

# cd ../lua-5.1.4

i use emacs, but feel free to use your favorite editor

# emacs src/Makefile

 

find the line that says

CFLAGS= -O2 -Wall $(MYCFLAGS)

 

and change it to

CFLAGS= -O2 -Wall -fpic $(MYCFLAGS)

 

recompile lua now with -fpic (File Position Independent Code, basically creates library files that other programs can link against)

# make clean

# make linux

# make install

 

# cd ../asterisk-1.6.2.0-rc3

# make

 

now we finally get to the all-so-desired

+--------- Asterisk Build Complete ---------+

+ Asterisk has successfully been built, and +

+ can be installed by running: +

+ +

+ make install +

+-------------------------------------------+

 

Well, lets follow it's advise :)

# make install

 

Finally lets compile the remaining modules:

#cd ../asterisk-addons-1.6.2.0-rc1

# ./configure

 

I usually don't even do this, stock apps seem to be what we use anyways, but you NEED this package for realtime mysql connectivity

# make menuselect

 

# make

# make install

 

Once that completes we are pretty much done and this tutorial will cut off (and i go to finish this install)

 

Hope this helps someone, cuz it took me a good chunk of time to figure everything out... Enjoy

Link to comment
Share on other sites

just a note, setting this up on CentOS 5.4 at the moment, and:

 

CentOS 5.4, glib-2.0 version is updated to 2.13.2, and mysql proxy still requires at least 2.16.0, and this prevents you from building the latest mysql proxy, and so this tutorial still stands for the time being...

 

Ok one thing i have struck with 5.4 to watch out for

 

you will need to skip the linking of libcom_err.so.2 above, run

# yum install compat-libcom_err

 

and then link the libcom_err.so.3 to libcom_err.so via

# ln -sf /usr/lib64/libcom_err.so.3 /usr/lib64/libcom_err.so

 

though if you follow that,

 

# ls /usr/lib64/libcom* -lsah

48K -r--r--r-- 1 root root 44K Sep 3 15:52 /usr/lib64/libcom_err.a

4.0K lrwxrwxrwx 1 root root 26 Nov 2 15:41 /usr/lib64/libcom_err.so -> /usr/lib64/libcom_err.so.3

4.0K lrwxrwxrwx 1 root root 19 Nov 2 15:33 /usr/lib64/libcom_err.so.3 -> libcom_err.so.3.0.0

8.0K -rwxr-xr-x 1 root root 3.9K Jan 20 2009 /usr/lib64/libcom_err.so.3.0.0

 

so you can just as well run this and point directly :shrug:

# ln -sf /usr/lib64/libcom_err.so.3.0.0 /usr/lib64/libcom_err.so

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...