Skip to content

Instantly share code, notes, and snippets.

@dannguyen
Last active May 30, 2018 05:19
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save dannguyen/3866388de46f1793dfe1 to your computer and use it in GitHub Desktop.
Save dannguyen/3866388de46f1793dfe1 to your computer and use it in GitHub Desktop.
Make everything install on Ubuntu 14.04 and 14.10, specifically for AWS and DigitalOcean
## Tested on 14.04 and 14.10. Runs as root because why not
## Installs:
# - Ubuntu developer tools
# - Python (using system 2.7.6 / 2.7.8)
# - scipy libs
# - scikit-learn
# - nltk
# - Ruby 2.1.5
# - rbenv
# - nokogiri
# - t (for command-line twitter)
# - R (r-base-core)
# - Graphics/multimedia
# - graphicsmagick
# - tesseract-ocr
# - xpdf
# - libav
# - Web stuff
# - nginx
# - xpdf
# - pup (commandline HTML parsing)
# - jq (commandline JSON parsing)
# - opencv 2.4.10 without ffmpeg
red_echo () {
echo -e "-> \033[0;31m$(date)\033[0m";
echo -e "-> \033[0;31m$1\033[0m";
echo "------------------------";
}
DOWNLOADS_DIR="$HOME/Downloads"
mkdir -p $DOWNLOADS_DIR
red_echo "Maintaining and updating the distro"
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove
red_echo "Building developer tools"
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
################### Languages
red_echo "Installing languages"
########### Python, we just stick with the system python
### SciPy stack
red_echo "Installing Python scientific libs"
sudo apt-get install -y python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
## Other scientific libraries
pip install -U scikit-learn
pip install -U nltk
################ R
red_echo "Installing R"
sudo apt-get -y install r-base
############## Ruby time
RUBY_VER='2.1.5'
red_echo "Installing Ruby $RUBY_VER via rbenv (this will take awhile)"
cd ~ && git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
rbenv install $RUBY_VER
rbenv global $RUBY_VER
# configure gems to not store documentation
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
red_echo "Installing some useful Rubygems"
gem install bundler t nokogiri
############################### Ubuntu multimedia packages
red_echo "Add some multimedia Ubuntu packages"
sudo apt-get install -y graphicsmagick graphicsmagick-imagemagick-compat libav-tools tesseract-ocr unzip xpdf
############### Now install internet niceties
red_echo "Installing nginx"
sudo apt-get install -y nginx
red_echo "Installing exim4 mail server"
apt-get -y install exim4
red_echo "Follow instructions here: https://www.digitalocean.com/community/tutorials/how-to-install-the-send-only-mail-server-exim-on-ubuntu-12-04"
######### Non-ubuntu packages
red_echo "Installing non-Ubuntu packages"
red_echo "Installing jq"
curl http://stedolan.github.io/jq/download/linux64/jq -o /usr/local/bin/jq
chmod +x /usr/local/bin/jq
PUP_ARCH=linux_amd64
PUP_VERSION="3.6"
red_echo "Installing pup ${PUP_VERSION}"
cd $DOWNLOADS_DIR
curl https://github.com/EricChiang/pup/releases/download/v0.${PUP_VERSION}/pup_${PUP_ARCH}.zip -o pup_${PUP_ARCH}.zip
unzip pup_${PUP_ARCH}.zip && rm pup_${PUP_ARCH}.zip
sudo mv pup /usr/local/bin
### opencv from source
# first, installing some utilities
sudo apt-get install -y qt-sdk unzip
OPENCV_VER=2.4.10
red_echo "Installing OpenCV ${OPENCV_VER}. This will take a LONG time"
cd $DOWNLOADS_DIR
curl "http://fossies.org/linux/misc/opencv-${OPENCV_VER}.zip" -o opencv-${OPENCV_VER}.zip
unzip "opencv-${OPENCV_VER}.zip" && cd "opencv-${OPENCV_VER}"
mkdir build && cd build
# build without ffmpeg
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON \
-D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON \
-D WITH_FFMPEG=OFF ..
make
sudo make install
#######################################
red_echo "All done!"
############# Non-used anaconda instructions
# red_echo "Installing Python via Anaconda"
# curl http://09c8d0b2229f813c1b93-c95ac804525aac4b6dba79b00b39d1d3.r79.cf1.rackcdn.com/Anaconda-2.1.0-Linux-x86_64.sh -o /tmp/anaconda-install.sh
# # this will install it automatically
# bash /tmp/anaconda-install.sh -b
# echo 'export PATH="$HOME/anaconda/bin:$PATH"' >> ~/.bashrc
# exec $SHELL
# red_echo "installing helpful python packages"
# pip install csvkit
# conda install --yes binstar
# conda install --yes -c https://conda.binstar.org/menpo opencv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment