Fedora28.1下安装配置Thrift开发环境

主要参考 https://www.iteblog.com/archives/1699.html?from=like
感谢

将我的操作记录如下

大前提是执行命令所在的目录不能包含中文,切记!!!

可以先用命令行安装试试,如果不行则继续使用源码编译安装,如下:
cd /etc/yum.repos.d/
wget -c http://download.opensuse.org/repositories/home:/jblunck:/messaging/CentOS_CentOS-6/home:jblunck:messaging.repo
yum makecache
yum install thrift

以下是基于源码的安装步骤,亲测好用。
一,更新系统
sudo yum -y update
这个大概会有1549个更新包,超过800M的下载量,大家准备好时间,中间最好不要断网或关机
二,安装Platform Development Tools
sudo yum -y groupinstall "Development Tools"
三,添加C++语言需要的依赖
sudo yum -y install libevent-devel zlib-devel openssl-devel
sudo dnf -y install gcc-c++
四,升级m4
wget http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.xz
tar xvf m4-1.4.18.tar.xz
cd m4-1.4.18/
sudo ./configure
sudo make
sudo make install
注意不要连起来执行sudo ./configure && make && make install,会报错类似“fatal error :gl_avltree_oset.Tpo access denied”
五,依次更新autoconf/automake/bison
更新autoconf
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xvf autoconf-2.69.tar.gz
cd autoconf-2.69
sudo ./configure --prefix=/usr
sudo make
sudo make install

更新perl,否则编译automake会报错
sudo dnf -y install perl-Thread-Queue.noarch
参考 https://stackoverflow.com/questions/39141038/unable-to-build-gnu-automake

更新automake
wget http://ftp.gnu.org/gnu/automake/automake-1.16.tar.gz
tar xvf automake-1.16.tar.gz
cd automake-1.16
sudo ./configure --prefix=/usr
sudo make
sudo make install

更新bison
wget http://ftp.gnu.org/gnu/bison/bison-3.1.tar.gz
tar xvf bison-3.1.tar.gz
cd bison-3.1/
sudo ./configure --prefix=/usr
sudo make
sudo make install

升级Boost到1.53及其之上
wget https://jaist.dl.sourceforge.net/project/boost/boost/1.66.0/boost_1_66_0.tar.bz2
tar xvf boost_1_66_0.tar.bz2
cd boost_1_66_0
sudo ./bootstrap.sh
sudo ./b2 install

编译并安装Apache Thrift IDL Compiler
不要下载git库,而是从release中下载压缩包进行编译安装
首先安装依赖库
sudo dnf -y install libtool
sudo dnf -y install flex

再下载
wget https://github.com/apache/thrift/archive/0.11.0.tar.gz
tar zvf 0.11.0.tar.gz
cd thrift-0.11.0/
sudo ./bootstrap.sh
sudo ./configure --with-lua=no
sudo make
sudo make install

Apache Thrift IDL Compiler默认是安装在/usr/local/bin/thrift路径,到现在我们的Apache Thrift就已经安装完成了,我们可以在终端输入thrift来检验是否安装成功:
[iteblog@iteblog /home/iteblog/thrift]$ thrift -version
Thrift version 0.9.3

[iteblog@iteblog /home/iteblog/thrift]$ thrift
Usage: thrift [options] file

Use thrift -help for a list of options

你可能感兴趣的:(Fedora28.1下安装配置Thrift开发环境)