ubuntu下编译安装thrift
thrift homepage:
thrift 介绍安装资料见:
http://dongxicheng.org/search-engine/thrift-framework-intro/
http://www.javabloger.com/article/apache-thrift-architecture.html
http://abloz.com/2012/05/31/example-thrift-installation.html
安装基本工具和库
sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
安装Python开发环境
sudo apt-get install python-dev python-twisted
另外,还需要库地址加入PYTHONPATH, 在~/.bashrc文件末尾加入
export PYTHONPATH=/usr/lib/python2.6/site-packages
安装Java开发环境
1. 下载java linux安装包 jdk-6u38-linux-i586.bin
sudo mv ~/下载/jdk-6u38-linux-i586.bin /usr/local/java
chmod a+x jre-6u6-linux-i586.bin
./jre-6u<version>-linux-i586.bin
2. 设置环境变量,在/etc/profile.d/java.sh中加入
export JAVA_HOME=/usr/local/java/jdk1.6.0_06
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
3. 下载安装ant,ivy
wget http://labs.mop.com/apache-mirror//ant/binaries/apache-ant-1.8.4-bin.tar.gz
wget http://apache.spinellicreations.com//ant/ivy/2.3.0-rc2/apache-ivy-2.3.0-rc2-bin-with-deps.tar.gz
sudo tar xzvf apache-ant-1.8.4-bin.tar.gz -C /usr/local
sudo tar xzvf apache-ivy-2.3.0-rc2-bin-with-deps.tar.gz -C /usr/local
4. 进入ivy目录
cd /usr/local/apache-ivy-2.3.0-rc2
sudo cp ivy-2.3.0-rc2.jar ../apache-ant-1.8.4/lib
5. 设置环境变量,在/etc/profile.d/ant.sh中加入
export ANT_HOME=/usr/local/apache-ant-1.8.4
PATH=$ANT_HOME/bin:$PATH
下载安装thrift
wget https://dist.apache.org/repos/dist/release/thrift/0.9.0/thrift-0.9.0.tar.gz
tar xzf thrift-0.9.0.tar.gz
cd thrift-0.9.0/
./configure --prefix=/usr/local/ --with-boost=/usr/local --without-csharp --without-perl --without-php --without-php_extension --without-haskell --without-erlang --without-ruby
sudo make
sudo make install
测试
thrift -help