Last Updated: September 09, 2019
·
39.64K
· mpatrick

Installing PhantomJS 1.9 on Ubuntu 12.04 x64/x86

For 32-bit system
use phantomjs-1.9.0-linux-i686.tar.bz2

For 64-bit system
use phantomjs-1.9.0-linux-x86_64.tar.bz2

Go to the SHARE directory
cd /usr/local/share

Push file from google code

sudo wget https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-i686.tar.bz2

OR

sudo wget https://phantomjs.googlecode.com/files/phantomjs-1.9.0-linux-x86_64.tar.bz2

Extract the files to directory

sudo tar xjf phantomjs-1.9.0-linux-i686.tar.bz2

Move files to Phantom's directory

For x86 OS's do:
sudo ln -s /usr/local/share/phantomjs-1.9.0-linux-i686/bin/phantomjs /usr/local/share/phantomjs; sudo ln -s /usr/local/share/phantomjs-1.9.0-linux-i686/bin/phantomjs /usr/local/bin/phantomjs; sudo ln -s /usr/local/share/phantomjs-1.9.0-linux-i686/bin/phantomjs /usr/bin/phantomjs

For x64 OS's do:
sudo ln -s /usr/local/share/phantomjs-1.9.0-linux-x8664/bin/phantomjs /usr/local/share/phantomjs; sudo ln -s /usr/local/share/phantomjs-1.9.0-linux-x8664/bin/phantomjs /usr/local/bin/phantomjs; sudo ln -s /usr/local/share/phantomjs-1.9.0-linux-x86_64/bin/phantomjs /usr/bin/phantomjs

To check if completed, just type:
phantomjs --version
Must appear: 1.9

Done, you installed phantomJS on your machine.

11 Responses
Add your response

Hi Patrick - after executing 'sudo ln -s..' i get -> failed to create symbolic link ‘/usr/local/bin/phantomjs’: File exists

Any ideas as to why this happens?

over 1 year ago ·

Try to do sudo apt-get remove phantomjs first, then run the commands again.

over 1 year ago ·

sudo ln -s /usr/local/share/phantomjs-1.9.0-linux-x8664/bin/phantomjs /usr/local/share/phantomjs; sudo ln -s /usr/local/share/phantomjs-1.9.0-linux-x8664/bin/phantomjs /usr/local/bin/phantomjs; sudo ln -s /usr/local/share/phantomjs-1.9.0-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
ln: failed to create symbolic link ‘/usr/local/share/phantomjs’: File exists
ln: failed to create symbolic link ‘/usr/local/bin/phantomjs’: File exists
ln: failed to create symbolic link ‘/usr/bin/phantomjs’: File exists

phantomjs --version
1.9.0

over 1 year ago ·

This means that you already have phantomJS installed on your machine, try removing this and installing again, like nobbz said above.

over 1 year ago ·

Thanks for this Article, I think there is little typo error in your command. x8664 should be x86_64, otherwise links won't work properly.
Cheers

over 1 year ago ·

Thanks peterzil, I'll edit and fix this !

over 1 year ago ·

Thank you!

over 1 year ago ·

thanks mate

over 1 year ago ·

works, thanks

over 1 year ago ·

What's so wrong with sudo apt-get install phantomjs?

over 1 year ago ·

I get the following error when I try to check the phantomjs version

-bash: /usr/local/bin/phantomjs: cannot execute binary file

whats wrong with the installation and how to fix and reinstall phantomjs

over 1 year ago ·