Wednesday, 25 April 2012

PhantomJS On Ubuntu

is a web stack with but . These qualities are useful more widely but today I'm interested in for a website in , and . Time to make PhantomJS 1.5.0 run on (11.10)...

PhantomJS avoids make, autoconf et al, preferring to roll their own build system. So it's best to grab a binary and follow the installation instructions. For x86 and x86_64 grab the appropriate dynamic build. For other platforms, pick a different tool...

And here's how it went...



I grabbed the binary and stashed in /usr/local/share, versioned with a symbolic link
$ cd /usr/local/share/
$ sudo tar xzvf ~/Downloads/phantomjs-1.5.0-linux-x86_64-dynamic.tar.gz
$ sudo mv phantomjs phantomjs-1.5.0-x86_64
$ sudo ln -s /usr/local/share/phantomjs-1.5.0-x86_64/ /usr/local/share/phantomjs
$ sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs

Freetype is sometimes a troublesome umbrella
$ sudo apt-get install freetype
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package freetype

but can be worked around
$ sudo apt-get install libfreetype6 libfreetype6-dev

Simply tested
$ whereis phantomjs
phantomjs: /usr/local/bin/phantomjs
$ phantomjs --version
1.5.0

Done :-)

4 comments:

  1. That was quick and helped me install it in a jiffy. However, someone needs to get a PPA out there.

    ReplyDelete
  2. its giving me an error saying "cannot execute binary file" for some reason. :/

    ReplyDelete
  3. found the solution. My machine was running in 32 bit. but the phantom that i downloaded was in 64.

    ReplyDelete