Skip to content

Instantly share code, notes, and snippets.

@skmedix
Last active August 21, 2017 23:16
Show Gist options
  • Save skmedix/b3d1d265fc4d05b5d639b3764ca8f278 to your computer and use it in GitHub Desktop.
Save skmedix/b3d1d265fc4d05b5d639b3764ca8f278 to your computer and use it in GitHub Desktop.
PySnip 0.75 & Python 2.7 on Ubuntu 16.04
#!/bin/bash
clear
echo Installing Python dependencies..
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline6 libreadline6-dev libssl-dev libdb-dev gunzip
echo Done.
echo Downloading Python 2.7.12..
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
echo Done.
echo Unpacking..
tar -xzf Python-2.7.12.tgz
cd Python-2.7.12
echo Done.
echo Installing Python 2.7
./configure --prefix=/usr --enable-shared
make
sudo make install
cd ..
echo Done.
echo Setting the priority of Python command.
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 20
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 10
sudo update-alternatives --set python /usr/bin/python2.7
echo Done.
sleep 5
echo Downloading ez_setup..
wget http://peak.telecommunity.com/dist/ez_setup.py
echo Done.
echo Running ez_setup..
sudo python2.7 ez_setup.py
sudo easy_install-2.7 virtualenv
echo Done.
rm -rf ez_setup.py
rm -rf Python-2.7.12*
sleep 5
echo Downloading PySnip..
wget https://github.com/NateShoffner/PySnip/archive/f8808c5.tar.gz
echo Done.
echo Unpacking PySnip..
tar -xvzf f8808c5.tar.gz
echo Done.
rm -rf f8808c5.tar.gz
sleep 5
echo Renaming PySnip..
mv PySnip-f8808c55b2226ea3621f01b9f11105d1e3b80669 PySnip
cd PySnip
echo Done.
sleep 5
echo Installing PIP..
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
rm -rf get-pip.py
echo Done.
sleep 5
echo Running virtualenv..
virtualenv -p python2 venv
source ./venv/bin/activate
echo Done.
sleep 5
echo Installing PySnip Dependencies..
pip install cython==0.22 twisted jinja2 pillow==2.9.0 pygeoip pycrypto pyasn1
echo Done.
sleep 5
echo Building PySnip..
chmod a+x ./build.sh
./build.sh
echo Done.
cd feature_server/data/
echo Downloading GeoLiteCity.dat
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
echo Done.
sleep 5
echo Unpacking GeoLiteCity
gunzip GeoLiteCity.dat.gz
echo Done.
rm -rf GeoLiteCity.dat.gz
cd ../..
echo Everything is done ;)
sleep 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment