Download phantomjs over phantomjs.org/download.html then untargz it. Then link it to your path in order to call phantomjs
directly from console:
sudo ln -s /home/ubuntu/phantomjs/bin/phantomjs /usr/bin/phantomjs
Possible errors you will encounter
phantomjs: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory
phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
You should install following 2 packages for phantomjs to work:
sudo apt-get install libfreetype6 libfontconfig