Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ttakezawa/7977759 to your computer and use it in GitHub Desktop.
Save ttakezawa/7977759 to your computer and use it in GitHub Desktop.
without mysqlenv
#!/usr/bin/env bash
# This is inspired by https://gist.github.com/xaicron/5524548, but this doesn't require mysqlenv and zsh
#
# Prepare (for CentOS):
# cpanm MySQL::Sandbox
# sudo yum install cmake ncurses-devel
# mkdir -p ~/opt/mysql
# git clone git://github.com/kamipo/mysql-build.git ~/opt/mysql/mysql-build
# ~/opt/mysql/mysql-build/bin/mysql-build -v 5.1.69 ~/opt/mysql/5.1.69
# make_sandbox 5.1.69
#
# Usage:
# curl -kL https://gist.githubusercontent.com/ttakezawa/7977759/raw/q4m_and_handler_socket_install.sh | bash
set -e
MYSQL_CMD=$HOME/sandboxes/rsandbox_5_1_69/m
MYSQL_VERSION=5.1.69
MYSQL_BASEDIR=$HOME/opt/mysql/${MYSQL_VERSION}
MYSQL_SRCDIR=$HOME/opt/mysql/mysql-build/build/mysql-${MYSQL_VERSION}
Q4M_VERSION=0.9.13
if [ ! -d ~/tmp ]; then
mkdir ~/tmp
fi
### Q4M
echo -e "\e[1;32mStarting Q4M installation.\e[m"
cd ~/tmp
curl -O http://q4m.kazuhooku.com/dist/q4m-${Q4M_VERSION}.tar.gz
tar zxfv q4m-${Q4M_VERSION}.tar.gz
cd q4m-${Q4M_VERSION}
./configure --with-mysql=${MYSQL_SRCDIR} --prefix=${MYSQL_BASEDIR}
make && make install
$MYSQL_CMD < support-files/install.sql
$MYSQL_CMD -u root -e 'show plugins'
### HandlerSocket
echo -e "\e[1;32mStarting HandlerSocket installation.\e[m"
cd ~/tmp
if [ ! -d "HandlerSocket-Plugin-for-MySQL" ]; then
git clone git://github.com/DeNA/HandlerSocket-Plugin-for-MySQL.git
fi
cd HandlerSocket-Plugin-for-MySQL
git pull origin master
./autogen.sh
./configure --prefix=${MYSQL_BASEDIR} --with-mysql-source=${MYSQL_SRCDIR} --with-mysql-bindir=${MYSQL_BASEDIR}/bin --with-mysql-plugindir=${MYSQL_BASEDIR}/lib/mysql/plugin
make && make install
~/sandboxes/msb_5_1_69/my sql -u root -e "install plugin handlersocket soname 'handlersocket.so'"
cd perl-Net-HandlerSocket
curl -fsSL http://xrl.us/cpanm | perl - .
### finish
$MYSQL_CMD -u root -e 'show plugins'
echo -e "\e[1;32mdone.\e[m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment