Latest PhantomJS repository located at https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
Required Package
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install libfontconfig1 libfontconfig1-dev
If already installed:
cd /opt/
mkdir /opt/phantomjs
cd /opt/phantomjs
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2
Now set extracted package and set in Environment so we can execute phantomJS from all users
mv phantomjs-2.1.1-linux-x86_64 /usr/local/share/
ln -sf /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/
Remove temp dir and check if already installed
cd /opt/
rm -rf /opt/phantomjs
phantomjs --version
It should show: