Go Back   Science Forums > Help and Advice > Tutorials and How To's
Reply
 
LinkBack Thread Tools
Old 10-28-2009   #1 (permalink)
alexander's Avatar
Dedicated Smart-ass

Senior Moderator
Gallery Curator
Dev Team Member

Location:
Just before 0xAA55
 
alexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond repute
Send a message via AIM to alexander
 



Not Ranked  0 score     
Installing MySQL-Proxy and Asterisk (1.6.2.0-rc3) from source on CentOS 5.3

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
Code:
#!/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
# ./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:
Code:
   [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


----------------
"Oh, they say madness runs in our family. Some even call me mad. And why? Because I dared to dream of my own race of atomic monsters, atomic supermen with octagonal shaped bodies that suck blood..."

Last edited by alexander; 11-02-2009 at 05:05 PM.. Reason: added installing addons
Reply With Quote
Thanks from:
Tormod (10-28-2009)
Old 11-02-2009   #2 (permalink)
alexander's Avatar
Dedicated Smart-ass

Senior Moderator
Gallery Curator
Dev Team Member

Location:
Just before 0xAA55
 
alexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond reputealexander has a reputation beyond repute
Send a message via AIM to alexander
 



Not Ranked  0 score     
Re: Installing MySQL-Proxy and Asterisk (1.6.2.0-rc3) from source on CentOS 5.3

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
# ln -sf /usr/lib64/libcom_err.so.3.0.0 /usr/lib64/libcom_err.so


----------------
"Oh, they say madness runs in our family. Some even call me mad. And why? Because I dared to dream of my own race of atomic monsters, atomic supermen with octagonal shaped bodies that suck blood..."

Last edited by alexander; 11-02-2009 at 05:01 PM..
Reply With Quote
Reply

Bookmarks

Tags
aterisk, centos, fpic, install, linux, lua, mysql, mysql-proxy


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fun with MySQL alexander Computer Science and Technology 4 11-16-2009 08:53 AM
Connecting to MySQL Database codecruiser9999 Computer Science and Technology 4 01-08-2009 01:27 PM
mySQL Cedars Computer Science and Technology 41 11-24-2008 10:30 AM
My Server Proxy Unregistered Login problems 3 05-01-2006 05:33 AM

» Advertisement
» Current Poll
What is your favorite Winter Olympic Sport?
Ice Skating - 25.00%
5 Votes
Hockey - 15.00%
3 Votes
Downhill Skiing - 35.00%
7 Votes
Snowboarding - 20.00%
4 Votes
Cross-Country Skiing - 10.00%
2 Votes
Shootin' guns on skis - 10.00%
2 Votes
Curling - 30.00%
6 Votes
Bobsled/Luge/Skeleton - 20.00%
4 Votes
Ski Jumping - 25.00%
5 Votes
Speed Skating - 15.00%
3 Votes
Total Votes: 20
You may not vote on this poll.


All times are GMT -8. The time now is 07:21 AM.

Hypography?

Hypography [n.]: A combination of "hyperlink" and "bibliography" - ie, a list of links to electronic documents. Comparable to discography and bibliography, but not cartography.

We have been online since May 2000, and aim to be the best place to find and share science-related content of all kinds.

Share the love!

Please add more science to your life. Use our RSS feeds on your blog, your portal, or your favorite feedreader!


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Copyright © 2000-2009 Hypography
Part of the Hypography - Science for Everyone Network