Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev

Install these packages needed by PhantomJS to work correctly.

sudo apt-get install libfreetype6 libfreetype6-dev
sudo apt-get install libfontconfig1 libfontconfig1-dev

Get it from the PhantomJS website.

cd ~
export PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2

Once downloaded, move Phantomjs folder to /usr/local/share/ and create a symlink:

sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin

Now, It should have PhantomJS properly on your system.

phantomjs --version
#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
PHANTOM_VERSION="phantomjs-1.9.8"
ARCH=$(uname -m)
if ! [ $ARCH = "x86_64" ]; then
$ARCH="i686"
fi
PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
@SmurfyFR

This comment has been minimized.

Show comment
Hide comment
@SmurfyFR

SmurfyFR Sep 2, 2014

There is a mistake :

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/
cd /usr/local/share/
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs

should be :

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/
cd /usr/local/share/
sudo tar xvjf phantomjs-1.9.2-linux-x86_64.tar.bz2
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs

SmurfyFR commented Sep 2, 2014

There is a mistake :

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/
cd /usr/local/share/
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs

should be :

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/
cd /usr/local/share/
sudo tar xvjf phantomjs-1.9.2-linux-x86_64.tar.bz2
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs
@aminelaadhari

This comment has been minimized.

Show comment
Hide comment
@julionc

This comment has been minimized.

Show comment
Hide comment
@julionc

julionc Sep 30, 2014

good catch!
I updated the gist. Thank you guys!

Owner

julionc commented Sep 30, 2014

good catch!
I updated the gist. Thank you guys!

@karol-blaszczyk

This comment has been minimized.

Show comment
Hide comment
@karol-blaszczyk

karol-blaszczyk Oct 1, 2014

Thank you, that was i was looking for !

karol-blaszczyk commented Oct 1, 2014

Thank you, that was i was looking for !

@SizeSeeker

This comment has been minimized.

Show comment
Hide comment
@SizeSeeker

SizeSeeker Oct 8, 2014

Great gist, thank you!

SizeSeeker commented Oct 8, 2014

Great gist, thank you!

@shamabbas

This comment has been minimized.

Show comment
Hide comment
@shamabbas

shamabbas Oct 27, 2014

Great! Thank you!

shamabbas commented Oct 27, 2014

Great! Thank you!

@iobee

This comment has been minimized.

Show comment
Hide comment
@iobee

iobee Nov 19, 2014

Great! Thank you!

iobee commented Nov 19, 2014

Great! Thank you!

@lucassch

This comment has been minimized.

Show comment
Hide comment
@lucassch

lucassch commented Nov 26, 2014

Great!

@reminate

This comment has been minimized.

Show comment
Hide comment
@reminate

reminate Dec 9, 2014

Thank you!

reminate commented Dec 9, 2014

Thank you!

@nikulkarni

This comment has been minimized.

Show comment
Hide comment
@nikulkarni

nikulkarni Dec 15, 2014

exactly what I was looking for, thank you.

nikulkarni commented Dec 15, 2014

exactly what I was looking for, thank you.

@georgehenze

This comment has been minimized.

Show comment
Hide comment
@georgehenze

georgehenze Dec 27, 2014

Thanks a lot!

georgehenze commented Dec 27, 2014

Thanks a lot!

@talpa

This comment has been minimized.

Show comment
Hide comment
@talpa

talpa commented Jan 4, 2015

@idmontie

This comment has been minimized.

Show comment
Hide comment
@idmontie

idmontie Jan 10, 2015

๐Ÿ‘
Thanks for this write up. Note that Phantom is now on 1.9.8 though.

idmontie commented Jan 10, 2015

๐Ÿ‘
Thanks for this write up. Note that Phantom is now on 1.9.8 though.

@augnustin

This comment has been minimized.

Show comment
Hide comment
@augnustin

augnustin Jan 20, 2015

Why triple symbolic link? Just in case?

What about sudo apt-get install phantomjs? It did not work for me, but any idea why?

augnustin commented Jan 20, 2015

Why triple symbolic link? Just in case?

What about sudo apt-get install phantomjs? It did not work for me, but any idea why?

@Yakito

This comment has been minimized.

Show comment
Hide comment
@Yakito

Yakito Feb 3, 2015

Tested on an EC2 with Ubuntu 14.04, Works fine.

Yakito commented Feb 3, 2015

Tested on an EC2 with Ubuntu 14.04, Works fine.

@lethalbrains

This comment has been minimized.

Show comment
Hide comment
@lethalbrains

lethalbrains commented Feb 5, 2015

Thanx

@tbuchboeck

This comment has been minimized.

Show comment
Hide comment
@tbuchboeck

tbuchboeck Feb 5, 2015

JFYI:
We had some font issues recently (Debian GNU/Linux 7.8 (wheezy) pjs-1.9.7)
Installing sudo apt-get install msttcorefonts solved the problem.

tbuchboeck commented Feb 5, 2015

JFYI:
We had some font issues recently (Debian GNU/Linux 7.8 (wheezy) pjs-1.9.7)
Installing sudo apt-get install msttcorefonts solved the problem.

@q0rban

This comment has been minimized.

Show comment
Hide comment
@q0rban

q0rban Feb 5, 2015

Thanks for this! You shouldn't need to create that many symlinks, or export your $PHANTOM_JS variable. I would just symlink to /usr/local/bin.

q0rban commented Feb 5, 2015

Thanks for this! You shouldn't need to create that many symlinks, or export your $PHANTOM_JS variable. I would just symlink to /usr/local/bin.

@q0rban

This comment has been minimized.

Show comment
Hide comment
@q0rban

q0rban Feb 5, 2015

Here's a shorter version of the above:

sudo aptitude update
sudo aptitude install build-essential chrpath libssl-dev libxft-dev \
  libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
tar -xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -s /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
phantomjs --version

q0rban commented Feb 5, 2015

Here's a shorter version of the above:

sudo aptitude update
sudo aptitude install build-essential chrpath libssl-dev libxft-dev \
  libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
tar -xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -s /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
phantomjs --version
@tunnckoCore

This comment has been minimized.

Show comment
Hide comment
@tunnckoCore

tunnckoCore Feb 6, 2015

After all

bash: /usr/local/bin/phantomjs: cannot execute binary file: Exec format error

Ubuntu 14.04

tunnckoCore commented Feb 6, 2015

After all

bash: /usr/local/bin/phantomjs: cannot execute binary file: Exec format error

Ubuntu 14.04

@tunnckoCore

This comment has been minimized.

Show comment
Hide comment
@tunnckoCore

tunnckoCore Feb 6, 2015

Its okey. It was the arch :)

tunnckoCore commented Feb 6, 2015

Its okey. It was the arch :)

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Feb 13, 2015

q0rban: worked perfectly, thanks!

ghost commented Feb 13, 2015

q0rban: worked perfectly, thanks!

@pankajclabs

This comment has been minimized.

Show comment
Hide comment
@pankajclabs

pankajclabs Feb 27, 2015

phantomjs --version

getting this:

Fontconfig warning: ignoring UTF-8: not a valid region tag
1.9.8

please help me out, I really tried everything

pankajclabs commented Feb 27, 2015

phantomjs --version

getting this:

Fontconfig warning: ignoring UTF-8: not a valid region tag
1.9.8

please help me out, I really tried everything

@mgzrobles

This comment has been minimized.

Show comment
Hide comment
@mgzrobles

mgzrobles Mar 5, 2015

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

mgzrobles commented Mar 5, 2015

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

@jasseral

This comment has been minimized.

Show comment
Hide comment
@jasseral

jasseral Mar 17, 2015

same !! :(
ubuntu
phantomjs --version
-bash: /usr/local/bin/phantomjs: cannot execute binary file

jasseral commented Mar 17, 2015

same !! :(
ubuntu
phantomjs --version
-bash: /usr/local/bin/phantomjs: cannot execute binary file

@jasseral

This comment has been minimized.

Show comment
Hide comment
@jasseral

jasseral commented Mar 17, 2015

HELP !

@azenkovets

This comment has been minimized.

Show comment
Hide comment
@azenkovets

azenkovets Mar 18, 2015

Have the same issue:
phantomjs --version
-bash: /usr/local/bin/phantomjs: cannot execute binary file

azenkovets commented Mar 18, 2015

Have the same issue:
phantomjs --version
-bash: /usr/local/bin/phantomjs: cannot execute binary file

@TammoHeeren

This comment has been minimized.

Show comment
Hide comment
@TammoHeeren

TammoHeeren Mar 18, 2015

you may need to download the i686 version
PHANTOM_JS="phantomjs-1.9.8-linux-i686"

TammoHeeren commented Mar 18, 2015

you may need to download the i686 version
PHANTOM_JS="phantomjs-1.9.8-linux-i686"

@prakash89

This comment has been minimized.

Show comment
Hide comment
@prakash89

prakash89 Mar 19, 2015

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

prakash89 commented Mar 19, 2015

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

@prakash89

This comment has been minimized.

Show comment
Hide comment
@prakash89

prakash89 Mar 19, 2015

Thanks,
This works for me
PHANTOM_JS="phantomjs-1.9.8-linux-i686"

prakash89 commented Mar 19, 2015

Thanks,
This works for me
PHANTOM_JS="phantomjs-1.9.8-linux-i686"

@julionc

This comment has been minimized.

Show comment
Hide comment
@julionc

julionc Mar 20, 2015

I update this gist to v1.9.8.
For lazy ones like us. I attached install_phantomjs.sh script. Have fun!

Owner

julionc commented Mar 20, 2015

I update this gist to v1.9.8.
For lazy ones like us. I attached install_phantomjs.sh script. Have fun!

@Rolos

This comment has been minimized.

Show comment
Hide comment
@Rolos

Rolos Mar 29, 2015

Works perfectly, many thanks!

Rolos commented Mar 29, 2015

Works perfectly, many thanks!

@id-den

This comment has been minimized.

Show comment
Hide comment
@id-den

id-den commented Apr 9, 2015

Thanks!

@donaldali

This comment has been minimized.

Show comment
Hide comment
@donaldali

donaldali commented Apr 13, 2015

Awesome

@dominiquedutra

This comment has been minimized.

Show comment
Hide comment
@dominiquedutra

dominiquedutra Apr 17, 2015

Great stuff, thanks.

dominiquedutra commented Apr 17, 2015

Great stuff, thanks.

@ericallard0

This comment has been minimized.

Show comment
Hide comment
@ericallard0

ericallard0 commented Apr 20, 2015

Thanks !

@nhattan

This comment has been minimized.

Show comment
Hide comment
@nhattan

nhattan commented Apr 21, 2015

Thanks!

@IvRRimum

This comment has been minimized.

Show comment
Hide comment
@IvRRimum

IvRRimum Apr 30, 2015

install_phantomjs.sh - Works like charm, Thanks!

IvRRimum commented Apr 30, 2015

install_phantomjs.sh - Works like charm, Thanks!

@xcaliburs

This comment has been minimized.

Show comment
Hide comment
@xcaliburs

xcaliburs May 1, 2015

Thank you. Works fine, tested on EC2 with Ubuntu 14.04.

xcaliburs commented May 1, 2015

Thank you. Works fine, tested on EC2 with Ubuntu 14.04.

@vdloo

This comment has been minimized.

Show comment
Hide comment
@vdloo

vdloo May 6, 2015

thanks!

vdloo commented May 6, 2015

thanks!

@kumarldh

This comment has been minimized.

Show comment
Hide comment
@kumarldh

kumarldh May 17, 2015

Or you can build it on your machine as suggested on the site and then follow instructions from this page where the author starts moving the folder.

kumarldh commented May 17, 2015

Or you can build it on your machine as suggested on the site and then follow instructions from this page where the author starts moving the folder.

@shashank-saxena

This comment has been minimized.

Show comment
Hide comment
@shashank-saxena

shashank-saxena May 21, 2015

Thanks a ton!!!

shashank-saxena commented May 21, 2015

Thanks a ton!!!

@Plazik

This comment has been minimized.

Show comment
Hide comment
@Plazik

Plazik May 29, 2015

Thank you!

For fonts issue I have to install ttf-mscorefonts-installer too.

Plazik commented May 29, 2015

Thank you!

For fonts issue I have to install ttf-mscorefonts-installer too.

@carltondickson

This comment has been minimized.

Show comment
Hide comment
@carltondickson

carltondickson May 29, 2015

Amazingly simple <3

carltondickson commented May 29, 2015

Amazingly simple <3

@FurkanArslan

This comment has been minimized.

Show comment
Hide comment
@FurkanArslan

FurkanArslan Jun 3, 2015

Thank you very much man! โ˜บ๏ธ

FurkanArslan commented Jun 3, 2015

Thank you very much man! โ˜บ๏ธ

@ftcosta

This comment has been minimized.

Show comment
Hide comment
@ftcosta

ftcosta Jun 17, 2015

for Ubuntu14.04 and Mint

cd /usr/local/share
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
## system wide
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs

phantomjs -v

v//carlosdeoliveira.guru

change the version from 1.9.7 to 1.9.8

ftcosta commented Jun 17, 2015

for Ubuntu14.04 and Mint

cd /usr/local/share
sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
## system wide
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs

phantomjs -v

v//carlosdeoliveira.guru

change the version from 1.9.7 to 1.9.8

@alaabatayneh

This comment has been minimized.

Show comment
Hide comment
@alaabatayneh

alaabatayneh Jun 17, 2015

Thanks ftcosta

alaabatayneh commented Jun 17, 2015

Thanks ftcosta

@rbyelyy

This comment has been minimized.

Show comment
Hide comment
@rbyelyy

rbyelyy Jun 26, 2015

Thanks. Works like a sharm ;-)

rbyelyy commented Jun 26, 2015

Thanks. Works like a sharm ;-)

@n37r06u3

This comment has been minimized.

Show comment
Hide comment
@n37r06u3

n37r06u3 Jul 18, 2015

npm install phantomjs -g

n37r06u3 commented Jul 18, 2015

npm install phantomjs -g

@hebbian

This comment has been minimized.

Show comment
Hide comment
@hebbian

hebbian Jul 23, 2015

pankajclabs, I know that feel buddy, when no one helps out

hebbian commented Jul 23, 2015

pankajclabs, I know that feel buddy, when no one helps out

@rga-odoo

This comment has been minimized.

Show comment
Hide comment
@rga-odoo

rga-odoo Jul 23, 2015

Thank you ๐Ÿ‘

rga-odoo commented Jul 23, 2015

Thank you ๐Ÿ‘

@kafeltz

This comment has been minimized.

Show comment
Hide comment
@kafeltz

kafeltz Jul 28, 2015

The solution is so complex that I prefer using php -S localhost:80 for simple tests.

kafeltz commented Jul 28, 2015

The solution is so complex that I prefer using php -S localhost:80 for simple tests.

@lalitb

This comment has been minimized.

Show comment
Hide comment
@lalitb

lalitb Aug 7, 2015

For all those who are getting error "Cannot execute binary file" , please note these instructions are only for 64 bit architecture. For 32 bit, you may have to build phantomjs from source.

lalitb commented Aug 7, 2015

For all those who are getting error "Cannot execute binary file" , please note these instructions are only for 64 bit architecture. For 32 bit, you may have to build phantomjs from source.

@nroose

This comment has been minimized.

Show comment
Hide comment
@nroose

nroose Oct 27, 2015

Thanks for this!

nroose commented Oct 27, 2015

Thanks for this!

@Deele

This comment has been minimized.

Show comment
Hide comment
@Deele

Deele Nov 10, 2015

Thank you! Just installed it in vagrant and it works.

Deele commented Nov 10, 2015

Thank you! Just installed it in vagrant and it works.

@voodoorai2000

This comment has been minimized.

Show comment
Hide comment
@voodoorai2000

voodoorai2000 Nov 10, 2015

Thank you! It works ๐Ÿ‘

voodoorai2000 commented Nov 10, 2015

Thank you! It works ๐Ÿ‘

@lu-ko

This comment has been minimized.

Show comment
Hide comment
@lu-ko

lu-ko Nov 12, 2015

Problem: Fontconfig warning: ignoring UTF-8: not a valid region tag
Fix was in my case very simple, just add following variable to my bash profile: LC_ALL=en_US.UTF-8

lu-ko commented Nov 12, 2015

Problem: Fontconfig warning: ignoring UTF-8: not a valid region tag
Fix was in my case very simple, just add following variable to my bash profile: LC_ALL=en_US.UTF-8

@tonnydulo

This comment has been minimized.

Show comment
Hide comment
@tonnydulo

tonnydulo Nov 14, 2015

Thanks for This

tonnydulo commented Nov 14, 2015

Thanks for This

@adrianparr

This comment has been minimized.

Show comment
Hide comment
@adrianparr

adrianparr Nov 16, 2015

Thanks for this. It worked for me.

adrianparr commented Nov 16, 2015

Thanks for this. It worked for me.

@nando

This comment has been minimized.

Show comment
Hide comment
@nando

nando Nov 24, 2015

๐Ÿ‘

Thanks, thanks, thanks,
-- nando

nando commented Nov 24, 2015

๐Ÿ‘

Thanks, thanks, thanks,
-- nando

@mwillerich

This comment has been minimized.

Show comment
Hide comment
@mwillerich

mwillerich Dec 9, 2015

on Ubuntu 14.04 apt-get install phantomjs installs version 1.9.0-1 successfully for me.

mwillerich commented Dec 9, 2015

on Ubuntu 14.04 apt-get install phantomjs installs version 1.9.0-1 successfully for me.

@avral

This comment has been minimized.

Show comment
Hide comment
@avral

avral Dec 15, 2015

Thank you very much =)

avral commented Dec 15, 2015

Thank you very much =)

@dimanyc

This comment has been minimized.

Show comment
Hide comment
@dimanyc

dimanyc Dec 24, 2015

works! Thanks!

dimanyc commented Dec 24, 2015

works! Thanks!

@mkhusu

This comment has been minimized.

Show comment
Hide comment
@mkhusu

mkhusu Jan 4, 2016

amazing stuff!
Thanks so much! Have been trying to figure this out for quite some time now

mkhusu commented Jan 4, 2016

amazing stuff!
Thanks so much! Have been trying to figure this out for quite some time now

@jerryjohnjacob

This comment has been minimized.

Show comment
Hide comment
@jerryjohnjacob

jerryjohnjacob Jan 4, 2016

Awesome!! ๐Ÿ‘

jerryjohnjacob commented Jan 4, 2016

Awesome!! ๐Ÿ‘

@pette9

This comment has been minimized.

Show comment
Hide comment
@pette9

pette9 Jan 24, 2016

worked, Thank You ๐Ÿ‘

pette9 commented Jan 24, 2016

worked, Thank You ๐Ÿ‘

@makshark

This comment has been minimized.

Show comment
Hide comment
@makshark

makshark commented Feb 7, 2016

nice

@rotatopoti

This comment has been minimized.

Show comment
Hide comment
@rotatopoti

rotatopoti commented Feb 10, 2016

thanks

@lucas1

This comment has been minimized.

Show comment
Hide comment
@lucas1

lucas1 commented Mar 7, 2016

Thanks

@aidankmcl

This comment has been minimized.

Show comment
Hide comment
@aidankmcl

aidankmcl Mar 7, 2016

Just completed successfully with version 2.1.1, thanks!

aidankmcl commented Mar 7, 2016

Just completed successfully with version 2.1.1, thanks!

@ethagnawl

This comment has been minimized.

Show comment
Hide comment
@ethagnawl

ethagnawl Mar 7, 2016

Ha - and here I was worried this would be out-of-date...

But, seriously, this is incredibly useful. Thanks for putting it together and keeping it up-to-date!

ethagnawl commented Mar 7, 2016

Ha - and here I was worried this would be out-of-date...

But, seriously, this is incredibly useful. Thanks for putting it together and keeping it up-to-date!

@onliners

This comment has been minimized.

Show comment
Hide comment
@onliners

onliners Mar 15, 2016

Thanks a lot!

onliners commented Mar 15, 2016

Thanks a lot!

@stefnats

This comment has been minimized.

Show comment
Hide comment
@stefnats

stefnats Mar 17, 2016

Thanks! :-)

stefnats commented Mar 17, 2016

Thanks! :-)

@vivex

This comment has been minimized.

Show comment
Hide comment
@vivex

vivex commented Mar 28, 2016

Thanks

@MayankPratap

This comment has been minimized.

Show comment
Hide comment
@MayankPratap

MayankPratap commented Apr 2, 2016

Thanks :)

@langri-sha

This comment has been minimized.

Show comment
Hide comment
@langri-sha

langri-sha Apr 2, 2016

Thanks ๐Ÿ˜ป! Everyone, don't forget to look at the latest gist revision ๐Ÿ“

langri-sha commented Apr 2, 2016

Thanks ๐Ÿ˜ป! Everyone, don't forget to look at the latest gist revision ๐Ÿ“

@sridharkalaibala

This comment has been minimized.

Show comment
Hide comment
@sridharkalaibala

sridharkalaibala Apr 3, 2016

Thanks a lot friend :)

sridharkalaibala commented Apr 3, 2016

Thanks a lot friend :)

@rimidl

This comment has been minimized.

Show comment
Hide comment
@rimidl

rimidl commented Apr 11, 2016

Thanks!

@natanaugusto

This comment has been minimized.

Show comment
Hide comment
@natanaugusto

natanaugusto Apr 27, 2016

Thanks! Very helpful

natanaugusto commented Apr 27, 2016

Thanks! Very helpful

@yanshiyason

This comment has been minimized.

Show comment
Hide comment
@yanshiyason

yanshiyason commented May 1, 2016

Thanks!!!

@amihaiemil

This comment has been minimized.

Show comment
Hide comment
@amihaiemil

amihaiemil May 2, 2016

Great! Thank you very much!

amihaiemil commented May 2, 2016

Great! Thank you very much!

@andyxmas

This comment has been minimized.

Show comment
Hide comment
@andyxmas

andyxmas May 3, 2016

Worked like a charm on Ubuntu 14 getting version 2.1.1 of Phantom using https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2. Thanks!

andyxmas commented May 3, 2016

Worked like a charm on Ubuntu 14 getting version 2.1.1 of Phantom using https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2. Thanks!

@fawyna

This comment has been minimized.

Show comment
Hide comment
@fawyna

fawyna May 19, 2016

Thanks for the simple guide!

fawyna commented May 19, 2016

Thanks for the simple guide!

@kennytilton

This comment has been minimized.

Show comment
Hide comment
@kennytilton

kennytilton commented May 20, 2016

Brilliant.

@ghprod

This comment has been minimized.

Show comment
Hide comment
@ghprod

ghprod May 30, 2016

Thanks :)

ghprod commented May 30, 2016

Thanks :)

@achmadns

This comment has been minimized.

Show comment
Hide comment
@achmadns

achmadns commented May 31, 2016

Thanks.

@baras

This comment has been minimized.

Show comment
Hide comment
@baras

baras Jun 8, 2016

wget from Bitbucket sometimes results in a "20 redirection exceeded" error.
I would wget from github instead ( and get a newer version ๐Ÿ˜„ )

export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2

and thanks for this Gist ๐Ÿ‘

baras commented Jun 8, 2016

wget from Bitbucket sometimes results in a "20 redirection exceeded" error.
I would wget from github instead ( and get a newer version ๐Ÿ˜„ )

export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2

and thanks for this Gist ๐Ÿ‘

@JorgeRdg

This comment has been minimized.

Show comment
Hide comment
@JorgeRdg

JorgeRdg Jun 14, 2016

Thanks for the Gist!

JorgeRdg commented Jun 14, 2016

Thanks for the Gist!

@enfeizhan

This comment has been minimized.

Show comment
Hide comment
@enfeizhan

enfeizhan Jul 10, 2016

My sincere thanks. Heaps of instructions on the web but only yours works to me perfectly.

enfeizhan commented Jul 10, 2016

My sincere thanks. Heaps of instructions on the web but only yours works to me perfectly.

@a1exlism

This comment has been minimized.

Show comment
Hide comment
@a1exlism

a1exlism Jul 14, 2016

Thanks for sharing.

a1exlism commented Jul 14, 2016

Thanks for sharing.

@DanDvoracek

This comment has been minimized.

Show comment
Hide comment
@DanDvoracek

DanDvoracek commented Jul 20, 2016

Thanks!

@nisevi

This comment has been minimized.

Show comment
Hide comment
@nisevi

nisevi Aug 1, 2016

๐Ÿ‘

nisevi commented Aug 1, 2016

๐Ÿ‘

@milad145

This comment has been minimized.

Show comment
Hide comment
@milad145

milad145 Aug 8, 2016

how can i uninstall phantomjs?

milad145 commented Aug 8, 2016

how can i uninstall phantomjs?

@adamwlev

This comment has been minimized.

Show comment
Hide comment
@adamwlev

adamwlev Aug 9, 2016

Thank you!

adamwlev commented Aug 9, 2016

Thank you!

@mathieujobin

This comment has been minimized.

Show comment
Hide comment
@mathieujobin

mathieujobin Aug 16, 2016

Great script...
but this working curl command that worked for me

sudo curl --output /usr/local/bin/phantomjs https://s3.amazonaws.com/circle-downloads/phantomjs-2.1.1

from: https://discuss.circleci.com/t/add-phantomjs-2-1-1-to-the-platform/1755/4

mathieujobin commented Aug 16, 2016

Great script...
but this working curl command that worked for me

sudo curl --output /usr/local/bin/phantomjs https://s3.amazonaws.com/circle-downloads/phantomjs-2.1.1

from: https://discuss.circleci.com/t/add-phantomjs-2-1-1-to-the-platform/1755/4

@cankemik

This comment has been minimized.

Show comment
Hide comment
@cankemik

cankemik commented Sep 5, 2016

@loretoparisi

This comment has been minimized.

Show comment
Hide comment
@loretoparisi

loretoparisi Sep 5, 2016

So this is the updated script for 2.1.1 and the new tarball url

#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

PHANTOM_VERSION="phantomjs-2.1.1"
ARCH=$(uname -m)

if ! [ $ARCH = "x86_64" ]; then
    $ARCH="i686"
fi

PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y

cd ~
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs

loretoparisi commented Sep 5, 2016

So this is the updated script for 2.1.1 and the new tarball url

#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

PHANTOM_VERSION="phantomjs-2.1.1"
ARCH=$(uname -m)

if ! [ $ARCH = "x86_64" ]; then
    $ARCH="i686"
fi

PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y

cd ~
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs
@capitolkrs

This comment has been minimized.

Show comment
Hide comment
@capitolkrs

capitolkrs Sep 11, 2016

Thank you for the gist

capitolkrs commented Sep 11, 2016

Thank you for the gist

@mikesten

This comment has been minimized.

Show comment
Hide comment
@mikesten

mikesten Sep 13, 2016

@loretoparisi Thanks for the update! Small typo towards the end of your script...

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/ should be sudo mv $PHANTOM_JS /usr/local/share/

mikesten commented Sep 13, 2016

@loretoparisi Thanks for the update! Small typo towards the end of your script...

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/ should be sudo mv $PHANTOM_JS /usr/local/share/

@arturmalecki

This comment has been minimized.

Show comment
Hide comment
@arturmalecki

arturmalecki Oct 5, 2016

Good stuff ๐Ÿ‘

arturmalecki commented Oct 5, 2016

Good stuff ๐Ÿ‘

@juanpastas

This comment has been minimized.

Show comment
Hide comment
@juanpastas

juanpastas commented Oct 5, 2016

Thanks @mathieujobin

@miked0004

This comment has been minimized.

Show comment
Hide comment
@miked0004

miked0004 Oct 7, 2016

Thanks for this. Since it runs as root, it does not need sudo.

I dumped this in a Dockerfile here: https://gist.github.com/miked0004/b4aa62b62afbb16c67528f7b5f520041

See the docker-compose.yml in that gist for an example of running the box to bundle and run rake.

miked0004 commented Oct 7, 2016

Thanks for this. Since it runs as root, it does not need sudo.

I dumped this in a Dockerfile here: https://gist.github.com/miked0004/b4aa62b62afbb16c67528f7b5f520041

See the docker-compose.yml in that gist for an example of running the box to bundle and run rake.

@jmillxyz

This comment has been minimized.

Show comment
Hide comment
@jmillxyz

jmillxyz Nov 1, 2016

Thanks @mikesten and @loretoparisi -- the bitbucket URL for wget does work for me.

jmillxyz commented Nov 1, 2016

Thanks @mikesten and @loretoparisi -- the bitbucket URL for wget does work for me.

@tregenza

This comment has been minimized.

Show comment
Hide comment
@tregenza

tregenza Nov 19, 2016

Second to @mikesten comment on @loretoparisi 's script

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/ should be sudo mv $PHANTOM_JS /usr/local/share/

Other than than the script works perfectly.

tregenza commented Nov 19, 2016

Second to @mikesten comment on @loretoparisi 's script

sudo mv $PHANTOM_JS.tar.bz2 /usr/local/share/ should be sudo mv $PHANTOM_JS /usr/local/share/

Other than than the script works perfectly.

@FredyKonig

This comment has been minimized.

Show comment
Hide comment
@FredyKonig

FredyKonig Nov 23, 2016

what about :
sudo apt-get install phantomjs

FredyKonig commented Nov 23, 2016

what about :
sudo apt-get install phantomjs

@rista404

This comment has been minimized.

Show comment
Hide comment
@rista404

rista404 Dec 2, 2016

Thanks @loretoparisi and @mikesten for the updated script, works great! ๐ŸŽ‰

rista404 commented Dec 2, 2016

Thanks @loretoparisi and @mikesten for the updated script, works great! ๐ŸŽ‰

@ambikashri

This comment has been minimized.

Show comment
Hide comment
@ambikashri

ambikashri Dec 7, 2016

I am getting the below error. Could somebody suggest what could be done. I am using ubuntu

customer@QA-Ubuntu-1:~/automation$ phantomjs --webdriver=8090 --webdriver-selenium-grid-hub=http://127.0.0.1:4444
QXcbConnection: Failed to initialize XRandr
Qt: XKEYBOARD extension not present on the X server.
[INFO - 2016-12-07T10:46:27.715Z] GhostDriver - Main - running on port 8090
[INFO - 2016-12-07T10:46:27.720Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4444' version: using '127.0.0.1:8090' with org.openqa.grid.selenium.proxy.DefaultRemoteProxy as remote proxy. [ERROR - 2016-12-07T10:46:27.740Z] GhostDriver - main.fail - {"line":97,"stack":"register\nglobal code"}

ambikashri commented Dec 7, 2016

I am getting the below error. Could somebody suggest what could be done. I am using ubuntu

customer@QA-Ubuntu-1:~/automation$ phantomjs --webdriver=8090 --webdriver-selenium-grid-hub=http://127.0.0.1:4444
QXcbConnection: Failed to initialize XRandr
Qt: XKEYBOARD extension not present on the X server.
[INFO - 2016-12-07T10:46:27.715Z] GhostDriver - Main - running on port 8090
[INFO - 2016-12-07T10:46:27.720Z] GhostDriver - Main - registering to Selenium HUB 'http://127.0.0.1:4444' version: using '127.0.0.1:8090' with org.openqa.grid.selenium.proxy.DefaultRemoteProxy as remote proxy. [ERROR - 2016-12-07T10:46:27.740Z] GhostDriver - main.fail - {"line":97,"stack":"register\nglobal code"}

@z

This comment has been minimized.

Show comment
Hide comment
@z

z Dec 18, 2016

The other update for 2.1.1 had issues, I modified the script below:

#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

PHANTOM_VERSION="phantomjs-2.1.1"
ARCH=$(uname -m)

if ! [ $ARCH = "x86_64" ]; then
    $ARCH="i686"
fi

PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y

cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2

sudo mv $PHANTOM_JS /usr/local/share/
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs

z commented Dec 18, 2016

The other update for 2.1.1 had issues, I modified the script below:

#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

PHANTOM_VERSION="phantomjs-2.1.1"
ARCH=$(uname -m)

if ! [ $ARCH = "x86_64" ]; then
    $ARCH="i686"
fi

PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y

cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2

sudo mv $PHANTOM_JS /usr/local/share/
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs
@gautiermichelin

This comment has been minimized.

Show comment
Hide comment
@gautiermichelin

gautiermichelin Dec 28, 2016

If this script has to be run through a sudo, why the sudo lines at the end ?
It's redundant...

Prefer :

#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

PHANTOM_VERSION="phantomjs-2.1.1"
ARCH=$(uname -m)

if ! [ $ARCH = "x86_64" ]; then
    $ARCH="i686"
fi

PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"

apt-get update
apt-get -y install build-essential chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev

cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
tar xvjf $PHANTOM_JS.tar.bz2
mv $PHANTOM_JS /usr/local/share/
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs

@julionc nice and very useful gist :-) ๐Ÿ‘

gautiermichelin commented Dec 28, 2016

If this script has to be run through a sudo, why the sudo lines at the end ?
It's redundant...

Prefer :

#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

PHANTOM_VERSION="phantomjs-2.1.1"
ARCH=$(uname -m)

if ! [ $ARCH = "x86_64" ]; then
    $ARCH="i686"
fi

PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"

apt-get update
apt-get -y install build-essential chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev

cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2
tar xvjf $PHANTOM_JS.tar.bz2
mv $PHANTOM_JS /usr/local/share/
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs

@julionc nice and very useful gist :-) ๐Ÿ‘

@ssi-anik

This comment has been minimized.

Show comment
Hide comment
@ssi-anik

ssi-anik Jan 22, 2017

๐Ÿ‘ for the post, and if anyone wants to download the latest one, go get the file name, and change the PHANTOM_JS variable.

ssi-anik commented Jan 22, 2017

๐Ÿ‘ for the post, and if anyone wants to download the latest one, go get the file name, and change the PHANTOM_JS variable.

@illia108

This comment has been minimized.

Show comment
Hide comment
@illia108

illia108 Jan 26, 2017

Thanks. Worked for me!

illia108 commented Jan 26, 2017

Thanks. Worked for me!

@bologer

This comment has been minimized.

Show comment
Hide comment
@bologer

bologer Jan 26, 2017

ะ”ะปั ั‚ะตั…, ะบั‚ะพ ะผัƒั‡ะฐะตั‚ัั ัƒัั‚ะฐะฝะพะฒะบะพะน phantomjs 2.x.x ะฝะฐ Ubuntu 14.00/if you cannot easily install phantomjs 2.x.x on Ubuntu โ€” http://bologer.ru/kak-ustanovitobnovit-phantomjs-v-ubuntu-14-04/

bologer commented Jan 26, 2017

ะ”ะปั ั‚ะตั…, ะบั‚ะพ ะผัƒั‡ะฐะตั‚ัั ัƒัั‚ะฐะฝะพะฒะบะพะน phantomjs 2.x.x ะฝะฐ Ubuntu 14.00/if you cannot easily install phantomjs 2.x.x on Ubuntu โ€” http://bologer.ru/kak-ustanovitobnovit-phantomjs-v-ubuntu-14-04/

@frankie-loves-jesus

This comment has been minimized.

Show comment
Hide comment
@frankie-loves-jesus

frankie-loves-jesus Feb 4, 2017

Worked here as well, thanks for a wonderful thread!

frankie-loves-jesus commented Feb 4, 2017

Worked here as well, thanks for a wonderful thread!

@siddhantsomani

This comment has been minimized.

Show comment
Hide comment
@siddhantsomani

siddhantsomani Mar 15, 2017

Worked perfectly !
Thanks !!

siddhantsomani commented Mar 15, 2017

Worked perfectly !
Thanks !!

@janipaijanen

This comment has been minimized.

Show comment
Hide comment
@janipaijanen

janipaijanen Mar 17, 2017

There happened something in the download for me and being lazy to cleaning up things, I thought it would be better to force things happen.

For phantomjs-2.1.1

#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

PHANTOM_VERSION="phantomjs-2.1.1"
ARCH=$(uname -m)

if ! [ $ARCH = "x86_64" ]; then
    $ARCH="i686"
fi

PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"

apt-get update
apt-get -y install build-essential chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev

cd ~
wget -q https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 -O $PHANTOM_JS.tar.bz2
tar xvjf $PHANTOM_JS.tar.bz2

if [ -d /usr/local/share/$PHANTOM_JS ] ; then
  rm -rf /usr/local/share/$PHANTOM_JS
fi
mv -f $PHANTOM_JS /usr/local/share/
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs

janipaijanen commented Mar 17, 2017

There happened something in the download for me and being lazy to cleaning up things, I thought it would be better to force things happen.

For phantomjs-2.1.1

#!/usr/bin/env bash
# This script install PhantomJS in your Debian/Ubuntu System
#
# This script must be run as root:
# sudo sh install_phantomjs.sh
#

if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi

PHANTOM_VERSION="phantomjs-2.1.1"
ARCH=$(uname -m)

if ! [ $ARCH = "x86_64" ]; then
    $ARCH="i686"
fi

PHANTOM_JS="$PHANTOM_VERSION-linux-$ARCH"

apt-get update
apt-get -y install build-essential chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev

cd ~
wget -q https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 -O $PHANTOM_JS.tar.bz2
tar xvjf $PHANTOM_JS.tar.bz2

if [ -d /usr/local/share/$PHANTOM_JS ] ; then
  rm -rf /usr/local/share/$PHANTOM_JS
fi
mv -f $PHANTOM_JS /usr/local/share/
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/share/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin/phantomjs
ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/bin/phantomjs

@Lgofk

This comment has been minimized.

Show comment
Hide comment
@Lgofk

Lgofk Apr 14, 2017

very helpful! Thanks ;)

Lgofk commented Apr 14, 2017

very helpful! Thanks ;)

@diego-augusto

This comment has been minimized.

Show comment
Hide comment
@diego-augusto

diego-augusto commented Apr 25, 2017

Thanks!

@alihesari

This comment has been minimized.

Show comment
Hide comment
@alihesari

alihesari Apr 28, 2017

PhantomJS is on npm. You can run this command to install it globally:

npm install -g phantomjs-prebuilt

alihesari commented Apr 28, 2017

PhantomJS is on npm. You can run this command to install it globally:

npm install -g phantomjs-prebuilt

@mbriceno

This comment has been minimized.

Show comment
Hide comment
@mbriceno

mbriceno May 15, 2017

Perfect! thank a lot!!

mbriceno commented May 15, 2017

Perfect! thank a lot!!

@skylerto

This comment has been minimized.

Show comment
Hide comment
@skylerto

skylerto Jun 5, 2017

โค๏ธ

skylerto commented Jun 5, 2017

โค๏ธ

@nateGeorge

This comment has been minimized.

Show comment
Hide comment
@nateGeorge

nateGeorge Jun 13, 2017

Dude, awesome. Would be cool though if it grabbed the latest version automatically, since now we're at 2.1.1. But I guess if npm works, then that is easier than writing your own script.

nateGeorge commented Jun 13, 2017

Dude, awesome. Would be cool though if it grabbed the latest version automatically, since now we're at 2.1.1. But I guess if npm works, then that is easier than writing your own script.

@bchschaefer

This comment has been minimized.

Show comment
Hide comment
@bchschaefer

bchschaefer Jul 24, 2017

@nateGeorge

Just my quick&dirty one liner to grab the latest, non-beta, 64bit archive name:

PHANTOM_JS_LATEST=$(curl -s https://bitbucket.org/ariya/phantomjs/downloads/ | grep -i -e zip -e bz2 | grep -vi beta | grep -i linux-x86_64 | grep -v symbols | cut -d '>' -f 2 | cut -d '<' -f 1 | head -n 1)

bchschaefer commented Jul 24, 2017

@nateGeorge

Just my quick&dirty one liner to grab the latest, non-beta, 64bit archive name:

PHANTOM_JS_LATEST=$(curl -s https://bitbucket.org/ariya/phantomjs/downloads/ | grep -i -e zip -e bz2 | grep -vi beta | grep -i linux-x86_64 | grep -v symbols | cut -d '>' -f 2 | cut -d '<' -f 1 | head -n 1)

@pedrocaseiro

This comment has been minimized.

Show comment
Hide comment
@pedrocaseiro

pedrocaseiro commented Aug 31, 2017

Awesome!

@Unayung

This comment has been minimized.

Show comment
Hide comment
@Unayung

Unayung Sep 5, 2017

Thank you so much !!!! @janipaijanen. โค๏ธ โค๏ธ โค๏ธ

Unayung commented Sep 5, 2017

Thank you so much !!!! @janipaijanen. โค๏ธ โค๏ธ โค๏ธ

@ManuelTS

This comment has been minimized.

Show comment
Hide comment
@ManuelTS

ManuelTS Sep 28, 2017

With the version of @janipaijanen you will have the tar.bz2 file lying around in your home folder. I used /tmp/ instead to delete it automatically when the computer shuts down.

Thanks a ton @janipaijanen!

Here the changed gist:
https://gist.github.com/ManuelTS/935155f423374e950566d05d1448038d

ManuelTS commented Sep 28, 2017

With the version of @janipaijanen you will have the tar.bz2 file lying around in your home folder. I used /tmp/ instead to delete it automatically when the computer shuts down.

Thanks a ton @janipaijanen!

Here the changed gist:
https://gist.github.com/ManuelTS/935155f423374e950566d05d1448038d

@JhonattaSantos

This comment has been minimized.

Show comment
Hide comment
@JhonattaSantos

JhonattaSantos commented Nov 22, 2017

Thanks a lot!

@empeje-mid

This comment has been minimized.

Show comment
Hide comment
@empeje-mid

empeje-mid Nov 27, 2017

Thank a lot!

I do some modification from your script for dockerizing purpose

https://gist.github.com/mappuj1/31e6dea39d48d56c74ead82177fd0523

empeje-mid commented Nov 27, 2017

Thank a lot!

I do some modification from your script for dockerizing purpose

https://gist.github.com/mappuj1/31e6dea39d48d56c74ead82177fd0523

@akilawickey

This comment has been minimized.

Show comment
Hide comment
@akilawickey

akilawickey commented Mar 27, 2018

Cool Thanks

@b3none

This comment has been minimized.

Show comment
Hide comment
@b3none

b3none Jun 7, 2018

You saved me!

b3none commented Jun 7, 2018

You saved me!

@iamvinny

This comment has been minimized.

Show comment
Hide comment
@iamvinny

iamvinny Jun 15, 2018

Why the fixed version though? PhantomJS has been updated, the currently version is 2.1.1.

iamvinny commented Jun 15, 2018

Why the fixed version though? PhantomJS has been updated, the currently version is 2.1.1.

@julesmqz

This comment has been minimized.

Show comment
Hide comment
@julesmqz

julesmqz Sep 2, 2018

Thank you very much. working now

julesmqz commented Sep 2, 2018

Thank you very much. working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment