天天看點

Thrift學習(2)-安裝thrift安裝安裝流程備注

thrift安裝

thrift的安裝方法在thrift的官網上已經有比較詳細的安裝流程,我在參照官方說明安裝的時候遇到一些錯誤,特做個筆記記錄一下友善以後查詢。我的系統是

安裝流程

  • Update the System
sudo yum -y update
           
  • Install the Platform Development Tools
  • Upgrade autoconf/automake/bison
    • Upgrade autoconf
      wget http://ftp.gnu.org/gnu/autoconf/autoconf-.tar.gz
      tar xvf autoconf-.tar.gz
      cd autoconf-
      ./configure --prefix=/usr
      make
      sudo make install
      cd ..
                 
    • Upgrade automake
    wget http://ftp.gnu.org/gnu/automake/automake-.tar.gz
    tar xvf automake-.tar.gz
    cd automake-
    ./configure --prefix=/usr
    make
    sudo make install
    cd ..
               
    • Upgrade bison
    wget http://ftp.gnu.org/gnu/bison/bison-.tar.gz
    tar xvf bison-.tar.gz
    cd bison-
    ./configure --prefix=/usr
    make
    sudo make install
    cd ..
               
  • install bzip
sudo yum whatprovides */bzlib.h
yum install bzip2-devel--el6_0.x86_64
           
  • Add Optional C++ Language Library Dependencies
    • Install C++ Lib Dependencies

      sudo yum -y install libevent-devel zlib-devel openssl-devel

    • install libevent2
      wget https://github.com/libevent/libevent/releases/download/release--stable/libevent--stable.tar.gz
      
      tar xvf libevent--stable.tar.gz
      cd libevent--stable
      ./configure  --prefix=/usr/local
      make
      make install
      cd ..
                 
    • Upgrade Boost >= 1.53
      wget http://sourceforge.net/projects/boost/files/boost//boost_1_53_0.tar.gz
      tar xvf boost_1_53_0.tar.gz
      cd boost_1_53_0
      ./bootstrap.sh
      sudo ./b2 install
                 
  • Build and Install the Apache Thrift IDL Compiler
git clone https://git-wip-us.apache.org/repos/asf/thrift.git
cd thrift
./bootstrap.sh
 ./configure ***--with-lua=no --with-libevent=/usr/local --with-boost-libdir=/usr/local/lib***
make
sudo make install
           

備注

在我安裝的過程中,按照官網的安裝說明并沒有一次安裝成功。主要遇到一下問題

  • 缺少一些必備的基本依賴庫,比如bzip、libevent2庫,特别是libevent2庫是Thrift支援并發的依賴庫
  • 預設配置會出錯,在安裝時如果不指定libevent的安裝位置,使用預設配置會導緻無法找到libevent庫。為了避免少走彎路,最好是直接指定libevent庫的安裝位置
  • thrift版本問題,我安裝時最新的穩定版是0.9.3,checkout到0.9.3按照部落格中的方法能安裝成功,但是直接使用master分支的代碼安裝無法編譯通過,具體的原因還抽出時間查找。後續再研究研究。