#!/bin/bash

yum install -y zip* unzip* wget* gdb lrzsz

#install g++
yum install gcc gcc-c++

#install sz/rz 
yum install -y lrzsz

#install unixodbc-2.3.0

cd /tmp

wget http://gengxin.odao.com/linux/install/openlogic-unixodbc-2.3.0-all-src-2.zip

unzip openlogic-unixodbc-2.3.0-all-src-2.zip && cd unixodbc-2.3.0-src
./configure &&make && make install

#install unixODBC-2.3.1

cd /tmp

wget http://gengxin.odao.com/linux/install/unixODBC-2.3.1.tar

tar -xvf unixODBC-2.3.1.tar && cd unixODBC-2.3.1

./configure && make && make install

#install freetds-0.91

cd /tmp

wget http://gengxin.odao.com/linux/install/freetds-stable.tgz

tar -zxvf freetds-stable.tgz && cd freetds-0.91

./configure && make && make install

echo "ulimit -c unlimited" >> /etc/profile

echo "export ODBCSYSINI=/usr/local/etc" >> /etc/profile

echo "LANG=en_US.UTF-8" > /etc/sysconfig/i18n

echo "/usr/local/lib" >> /etc/ld.so.conf

echo "/usr/lib" >> /etc/ld.so.conf
 
ldconfig

echo -e "[sql_gametest]\n\thost = 218.6.15.106\n\tport = 1433\n\ttds version = 4.2\n\tclient charset = GBK\n[sql_gamelog]\n\thost = 218.6.15.107\n\tport = 1433\n\ttds version = 4.2\n\tclient charset = GBK\n[yun_gamelog]\n\thost = 114.215.172.51\n\tport = 1433\n\ttds version = 4.2\n\tclient charset = GBK" >> /usr/local/etc/freetds.conf

echo -e "[tds]\nDRIVER = /usr/local/lib/libtdsodbc.so" >> /usr/local/etc/odbcinst.ini

echo -e "[qp_gametest_db]\nDriver = tds\nServerName = sql_gametest\nDatabase = QPGameTestDB\n\n[qp_gamelog_db]\nDriver = tds\nServerName = sql_gamelog\nDatabase = QPGameLogDB\n\n[qp_gamenew_db]\nDriver = tds\nServerName = sql_gametest\nDatabase = QPGameNewDB\n\n[qp_newlobby_db]\nDriver = tds\nServerName = sql_gametest\nDatabase = QPNewLobbyDB\n\n[mysql_gamelog_db]\nDriver = MySQL ODBC Driver\nServer = rm-bp1oue0607q6idhy8.mysql.rds.aliyuncs.com\nDatabase = qp_lobby_log_db\nPort = 3306\nCharSet = gb2312\n\n[mysql_gamedata_db]\nDriver = MySQL ODBC Driver\nServer = rm-bp1b17yt2z00653dk.mysql.rds.aliyuncs.com\nDatabase = plat_activity_data_db\nPort = 3306\nCharSet = gb2312" > /usr/local/etc/odbc.ini

yum install -y mysql-connector-odbc

echo -e "\n[MySQL ODBC Driver]\nDRIVER=/usr/lib/libmyodbc5.so\nUsageCount=1" >> /usr/local/etc/odbcinst.ini

ln -s  /usr/lib64/libmyodbc5-5.1.5.so /usr/lib/libmyodbc5.so

cd /usr/local/lib
wget http://gengxin.odao.com/linux/install/libxredis64/libxredis.so
wget http://gengxin.odao.com/linux/install/libhiredis.so

ln -s libhiredis.so libhiredis.so.0.11
ln -s libxredis.so libxredis.so.0.11


