Installing Apache Thrift in Ubuntu

I have been dabbling with Apache Thrift the last couple of days, both on Windows and in Ubuntu Linux. If you are anything like me you will find the Thrift documentation lacking to say the least and that’s why I’m publishing this text and more will probably follow. I give you no guarantee that this will work for you as it did for me but it might give you a hint on how to solve your issues.

At the time of writing Thrift is not included in any of the standard Ubuntu package repositories and I was not able to find it in a launchpad ppa either. Finally I got the source from the Apache Subversion repository and started to look at the build instructions. Making a long story short, the prerequisites for compiling it are HUGE. This is actually a good thing since it comes from support in a big variety of programing languages. I just needed Python for my experiments and the Thrift compiler is built in C and CPP but I couldn’t get it to compile properly with just that no matter how I tried to disable the other features. So I had to take a Google moment and collect my thoughts…..

After some searching I came upon a issue in Thrifts bug tracker, What this says is that in December -10 someone committed the “debian” folder necessary to build proper .deb packages to the source code. One small issue though, you can find it inside the .contrib/ folder and not in the root folder as usual, otherwise I would have spotted it when trying to compile. It was also accompanied with a small shell script that linked this ./contrib/debian folder to the required ./debian path. This made life a lot easier since all dependencies and other stuff were given but… I really didn’t need or wanted all of those dependencies needed to build the packages installed on my system just to try it’s Python code out, what to do…?

On to the scene steps something called pbuilder which you can find the details about in What it does is basically provide a chrooted environment on your computer where debian packages will be built without messing with your normal installation.

The following instructions will install the things necessary to get pbuilder and to build the thrift packages and later install them. Be warned though, it will take some time to do since pbuilder basically installs a minimal Ubuntu environment in a chroot.

First pbuilder, set up for building maverick compatible debs:

$ sudo apt-get install debhelper pbuilder
$ cp /usr/share/doc/pbuilder/examples/ ~/bin
$ ln -s ~/bin/ ~/bin/pbuilder-maverick
$ mkdir ~/pbuilder
$ ~/bin/pbuilder-maverick create

This will give you a pbuilder environment ready to do some work… but what work?


  1. Download Thrift from and put it in your home folder. At the time of writing it was version 0.6.0
  2. Go back to the console once again and do...
    $ cd ~
    $ mkdir thrift
    $ cd thrift
    $ tar -zxf ../thrift-0.6.0.tar.gz
    $ cd thrift-0.6.0
    $ ln -s contrib/debian debian
    $ dpkg-buildpackage -S -us -uc
    $ cd ..
    $ ~/bin/pbuilder-maverick build *.dsc
  3. Wait…
  4. If all goes well you should now have a bunch of .deb files in ~/pbuilder/result. Install them as usual or with dpkg -i <the file you want>.deb
    for example… 

    $ dpkg -i thrift-0.6.0-dev1.tar.gz

This worked for me to get up and running with Thrift on Ubuntu. Hopefully it will be good use for someone else as well.


2 responses to “Installing Apache Thrift in Ubuntu

  1. Many thanks for posting this, wanted to add a few follow up steps for building on Percise with the latest Thrift. (Do this after the dpkg-buildpackage -S -us -uc step).

    1. Update pbuilder for precise.

    ~/bin/pbuilder-maverick update –distribution precise –override-config

    2. Add Universe/Multiverse support to pbuilder (In order to install mongrel).

    vi ~/.pbuilderrc

    Paste in:
    COMPONENTS=”main restricted universe multiverse”

    if [ “$DIST” == “squeeze” ]; then
    echo “Using a Debian pbuilder environment because DIST is $DIST”
    COMPONENTS=”main contrib non-free”

    3. Update pbuilder:
    ~/bin/pbuilder-maverick update –override-config

    4. ~/bin/pbuilder-maverick build *.dsc

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s