Skip to content

Instantly share code, notes, and snippets.

@swarad07
Last active February 15, 2018 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swarad07/1325dc427d82e4dcbee4699c60cb9501 to your computer and use it in GitHub Desktop.
Save swarad07/1325dc427d82e4dcbee4699c60cb9501 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Based on https://gist.github.com/ManuelTS/935155f423374e950566d05d1448038d
set -eo pipefail
# This script installs PhantomJS and Wraith along with its dependencies.
npm install -g casperjs
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
PHANTOM_VERSION="phantomjs-2.1.1"
ARCH=$(uname -m)
if ! [ $ARCH = "x86_64" ]; then
$ARCH="i686"
fi
PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"
apt-get update
apt-get -y install wget libicu-dev imagemagick rake build-essential chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev zlib1g-dev libffi-dev ruby-full && rm -rf /var/lib/apt/lists/*
cd /tmp/
echo "Downloading PhatomJS source."
wget -v https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 -O $PHANTOM_JS.tar.bz2
tar xvjf $PHANTOM_JS.tar.bz2
if [ -d /usr/local/share/$PHANTOM_JS ] ; then
rm -rf /usr/local/share/$PHANTOM_JS
fi
mv -f $PHANTOM_JS /usr/local/share/
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs
echo "Installed PhantomJS version:" && phantomjs --version
echo "Installed Ruby version:" && ruby -v
gem install wraith
echo "Installed Wraith version:" && wraith --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment