How to install phantomjs & casperjs

To install phantomjs & casperjs, do not use your distribution packages, you won’t have the right versions and your casperjs version will not be compatible with phantomjs version.

Instead, follow theses simple steps :

#phantomjs
cd /opt
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
tar xjvf phantomjs-1.9.7-linux-x86_64.tar.bz2
ln -s ln -s phantomjs-1.9.7-linux-x86_64 phantomjs
ln -s /opt/phantomjs/bin/phantomjs /usr/local/bin

#casperjs
cd /opt
wget https://codeload.github.com/n1k0/casperjs/legacy.zip/1.1-beta3
unzip 1.1-beta3
ln -s n1k0-casperjs-4f105a9/ casperjs
ln -s /opt/casperjs/bin/casperjs /usr/local/bin/

To test it, simply run the casperjs command

root@bigone:/opt# casperjs
CasperJS version 1.1.0-beta3 at /opt/casperjs, using phantomjs version 1.9.7
Usage: casperjs [options] script.1 [script argument [script argument ...]]
      casperjs [options] test [test path [test path ...]]
      casperjs [options] selftest
      casperjs [options] __selfcommandtest

Options: 

--verbose   Prints log messages to the console
--log-level Sets logging level
--help      Prints this help
--version   Prints out CasperJS version
--engine=name Use the given engine. Current supported engine: phantomjs and slimerjs

Read the docs http://docs.casperjs.org/