Remove any links symbolic links you may have had to phantomjs previously
#Remove Old Links
sudo rm -r /usr/local/share/phantomjs
sudo rm -r /usr/local/bin/phantomjs
sudo rm -r /usr/bin/phantomjs
Install or update to the latest system software.
#Install Pre Required Libs
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
Download phantomjs from the PhantomJS website and extract to your home folder
#Get and extract phantomjs-1.9.8-linux-i686
cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-i686.tar.bz2
sudo tar xvjf phantomjs-1.9.8-linux-i686.tar.bz2
Once downloaded, move Phantomjs folder to /usr/local/share/ and create a symlink:
sudo mv phantomjs-1.9.8-linux-i686 /usr/local/share
sudo ln -sf /usr/local/share/phantomjs-1.9.8-linux-i686/bin/phantomjs /usr/local/bin
Now, you should have PhantomJS properly installed on your system. The following will show you the version installed.
phantomjs --version