The following command installs all the required tools and libraries to build and install the Thrift compiler on a CentOS5/RHEL5 Linux based system.
sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel
These packages are available in the "base" repository.
For more information on the requirements see: ThriftRequirements
For more information on building and installing Thrift see: ThriftInstallation