Skip to content

Instantly share code, notes, and snippets.

@Dnile
Last active February 11, 2018 19:03
Show Gist options
  • Save Dnile/c3cd88025c2d26721979 to your computer and use it in GitHub Desktop.
Save Dnile/c3cd88025c2d26721979 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Install the necessary tools"
sudo apt-get update
sudo apt-get -y install make flex bison libtool libevent-dev automake pkg-config libssl-dev libboost-all-dev libbz2-dev build-essential g++ python-dev git
echo "git cloning Thrift"
apt-
git clone https://github.com/apache/thrift.git
pushd thrift
git fetch
git branch -a
git checkout 0.8.x # latest version at this time
# install jdk and ant if you need the java code generator
sudo apt-get -y install openjdk-7-jdk ant
./bootstrap.sh #ignore warning
./configure
make
sudo make install
# at thrift directory
pushd lib/py
sudo python setup.py install
popd
#------------------------------------------
# TESTING Thrift
#------------------------------------------
echo "Testing Thrift"
pushd tutorial
#in thrift/tutorial directory
thrift -r -v --gen java tutorial.thrift
echo "It willll generate a gen-java folder with sources if successful."
popd
#------------------------------------------
# Installing fb303
#------------------------------------------
echo "Now installing fb303..."
pushd contrib/fb303
#in thrift/contrib/fb303 directory
./bootstrap.sh
./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"
make
sudo make install
echo "Install Python Module for Thrift and fb303"
pushd py
sudo python setup.py install
echo "To check that the python modules have been installed properly, run:"
python -c 'import thrift' ; python -c 'import fb303'
popd
popd
popd
#------------------------------------------
# End Thrift
#------------------------------------------
echo "Installing Scribe..."
git clone https://github.com/facebook/scribe.git
pushd scribe
./bootstrap.sh
./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -DBOOST_FILESYSTEM_VERSION=2" LIBS="-lboost_system -lboost_filesystem"
make
sudo make install
echo "Export an environment variable"
export LD_LIBRARY_PATH=/usr/local/lib
echo "Install Python Module for Scribe"
pushd lib/py
sudo python setup.py install
echo "poor-man's Checking that the python modules have been install properly"
python -c 'import scribe'
popd
export LD_LIBRARY_PATH=/usr/local/lib
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc
popd
echo "PHEWWWWW..... finally"
echo "DONE. "
echo "TESTING THIS BB"
#to avoid scribed: error while loading shared libraries: libthrift-0.8.0.so: cannot open shared object file: No such file or directory
/sbin/ldconfig /usr/lib/libthrift-0.8.0.so
scribed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment