centos6下手工編譯vitess,centos6編譯vitess
vitess是youtub開源的一款mysql代理,在ubuntu下編譯很方便,但是在centos下且不能訪問google的情況下坑比較多。最近根據其bootstrap.sh指令碼手工編譯成功,把過程貼處來供有興趣的朋友參考一下。
升級automakewget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/monkeyiq:/centos6updates/CentOS_CentOS-6/noarch/automake-1.13.4-3.2.noarch.rpmwget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/monkeyiq:/centos6updates/CentOS_CentOS-6/noarch/autoconf-2.69-12.2.noarch.rpm
rpm -Uvh autoconf-2.69-12.2.noarch.rpm
rpm -Uvh automake-1.13.4-3.2.noarch.rpm
升級python至2.7,參考資料http://jingyan.baidu.com/article/da1091fb3fb589027849d6d7.htmlwget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
升級python-setuptools root使用者執行 wget https://bootstrap.pypa.io/ez_setup.py -O - | python 如果安裝失敗手動安裝步驟如下wget https://pypi.python.org/packages/source/s/setuptools/setuptools-17.0.tar.gz#md5=fd15d24ed1e4c95e56d8c6e812f3a84ftar zxvf setuptools-17.0.tar.gz
cd setuptools-17.0python ez_setup.py
升級pip到7.0.1 wget https://bootstrap.pypa.io/get-pip.py;python get-pip.py安裝virtualenv13.0.1 ;pip install virtualenvln -s /usr/local/bin/python2.7 /usr/bin/python2.7
-------------------------------------------------------------. ./dev.env
安裝zookeeperrm -fr $VTROOT/dist/vt-zookeeper-3.3.5
cd $VTTOP/third_party/zookeeper
tar -xjf zookeeper-3.3.5.tbz
mkdir -p $VTROOT/dist/vt-zookeeper-3.3.5/libcp zookeeper-3.3.5/contrib/fatjar/zookeeper-3.3.5-fatjar.jar $VTROOT/dist/vt-zookeeper-3.3.5/libcd zookeeper-3.3.5/src/c
./configure --prefix=$VTROOT/dist/vt-zookeeper-3.3.5
make -j3 install
cd $VTTOP/third_party/zookeeper
rm -fr zookeeper-3.3.5
# install protoc and proto python librariesprotobuf_dist=$VTROOT/dist/protobuf
rm -rf $VTROOT/dist/protobufcd $VTROOTmkdir -p $VTROOT/dist/protobuf/lib/python2.7/site-packagesexport PYTHONPATH=$VTROOT/dist/protobuf/lib/python2.7/site-packages:$PYTHONPATH參考./travis/install_protobuf.sh執行如下操作wget https://github.com/google/protobuf/archive/v3.0.0-alpha-1.tar.gztar zxvf v3.0.0-alpha-1.tar.gzcd $VTROOT/protobuf-3.0.0-alpha-1內建梯子,下載並解壓gtest在$VTROOT/protobuf-3.0.0-alpha-1目錄./autogen.sh $VTROOT/dist/protobuf
./configure --prefix=$VTROOT/dist/protobuf
cd python/
python setup.py install
# install gRPC C++ base, so we can install the python adaptersgrpc_dist=$VTROOT/dist/grpc
rm -rf $VTROOT/dist/grpc mkdir -p $VTROOT/dist/grpc 參考 ./travis/install_grpc.sh 執行git clone https://github.com/grpc/grpc.gitcd grpc
git submodule update --init
make install prefix=$VTROOT/dist/grpc
pip install -r src/python/requirements.txt -t $VTROOT/dist/grpc/lib/python2.7/site-packagesCFLAGS=-I$VTROOT/dist/grpc/include LDFLAGS=-L$VTROOT/dist/grpc/lib pip install --upgrade src/python/src -t $VTROOT/dist/grpc/lib/python2.7/site-packages
ln -nfs $VTTOP/third_party/go/launchpad.net $VTROOT/srcgo install launchpad.net/gozk/zookeeper
go get -u github.com/golang/protobuf/protogo get -u github.com/golang/gloggo get -u -a github.com/golang/protobuf/protoc-gen-go
以下go package在牆外需要手工下載編譯,golang中國提供相應打包下載http://www.golangtc.com/download/packagego get -u golang.org/x/net/context
go get -u golang.org/x/tools/cmd/goimports
go get -u github.com/golang/lint/golintgo get -u github.com/tools/godep
go get -u google.golang.org/grpc
go get -u github.com/modocache/gover
go get -u github.com/mattn/goveralls
ln -snf $VTTOP/config $VTROOT/configln -snf $VTTOP/data $VTROOT/dataln -snf $VTTOP/py $VTROOT/py-vtdbln -snf $VTTOP/go/zk/zkctl/zksrv.sh $VTROOT/bin/zksrv.shln -snf $VTTOP/test/vthook-test.sh $VTROOT/vthook/test.sh
echo "$MYSQL_FLAVOR" > $VTROOT/dist/MYSQL_FLAVOR
cp $VTTOP/config/gomysql.pc.tmpl $VTROOT/lib/gomysql.pcecho "Version:" "$($VT_MYSQL_ROOT/bin/mysql_config --version)" >> $VTROOT/lib/gomysql.pcecho "Cflags:" "$($VT_MYSQL_ROOT/bin/mysql_config --cflags) -ggdb -fPIC" >> $VTROOT/lib/gomysql.pcecho "Libs:" "$($VT_MYSQL_ROOT/bin/mysql_config --libs_r)" >> $VTROOT/lib/gomysql.pc
# install bsoncd $VTTOP/third_party/py/bson-0.3.2
python ./setup.py install --prefix=$VTROOT/dist/py-vt-bson-0.3.2
rm -r build
# install cbson
cd $VTTOP/py/cbson
python ./setup.py install --prefix=$VTROOT/dist/py-cbson
# create pre-commit hooksln -sf $VTTOP/misc/git/pre-commit $VTTOP/.git/hooks/pre-commit