Skip to content

Instantly share code, notes, and snippets.

@jstott
Last active December 30, 2015 23:49
Show Gist options
  • Save jstott/7903681 to your computer and use it in GitHub Desktop.
Save jstott/7903681 to your computer and use it in GitHub Desktop.
Install phantomjs script
#!/bin/bash
# Install phantomjs.
#
# Get file:
# wget https://gist.github.com/jstott/7903681/raw/fe0c616957d63f61fc06e45d5cacc66880cf4190/phantomjs-install.sh
# Change Permissions to execute
# chmod +x phantomjs-install.sh
# Usage: sudo ./phantomjs-install.sh
#
# By Jim Stott
#
# Tested on Ubuntu 13.10
# Created at: 2013-12-10
#
if [[ $EUID -ne 0 ]]; then
echo "To run this script you need to be root (or use sudo)" 2>&1
exit 1
fi
echo "-> apt-get update"
apt-get update
echo "-> install phantomjs"
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
# 64-bit stuff here
wget https://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-x86_64.tar.bz2
tar xvf phantomjs-1.9.2-linux-x86_64.tar.bz2
mv phantomjs-1.9.2-linux-x86_64 /usr/local/share/phantomjs
else
# 32-bit stuff here
wget https://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-i686.tar.bz2
tar xvf phantomjs-1.9.2-linux-i686.tar.bz2
mv phantomjs-1.9.2-linux-i686 /usr/local/share/phantomjs
fi
ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/bin/phantomjs
echo "-> all done - the next line should show the phantomjs version"
phantomjs --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment