#!/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 |
There is a mistake : should be : |
new url is https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 |
good catch! I updated the gist. Thank you guys! |
Thank you, that was i was looking for ! |
Great gist, thank you! |
Great! Thank you! |
Great! Thank you! |
Great! |
Thank you! |
exactly what I was looking for, thank you. |
Thanks a lot! |
I create bash script https://gist.github.com/talpa/16db1b8cfd3148364e19 |
Thanks for this write up. Note that Phantom is now on 1.9.8 though. |
Why triple symbolic link? Just in case? What about sudo apt-get install phantomjs ? It did not work for me, but any idea why? |
Tested on an EC2 with Ubuntu 14.04, Works fine. |
Thanx |
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. |
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. |
Here's a shorter version of the above: |
After all Ubuntu 14.04 |
Its okey. It was the arch :) |
q0rban: worked perfectly, thanks! |
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 |
ubuntu phantomjs --version -bash: /usr/local/bin/phantomjs: cannot execute binary file |
same !! :( ubuntu phantomjs --version -bash: /usr/local/bin/phantomjs: cannot execute binary file |
HELP ! |
Have the same issue: phantomjs --version -bash: /usr/local/bin/phantomjs: cannot execute binary file |
you may need to download the i686 version PHANTOM_JS='phantomjs-1.9.8-linux-i686' |
Ubuntu phantomjs --version -bash: /usr/local/bin/phantomjs: cannot execute binary file |
Thanks, This works for me PHANTOM_JS='phantomjs-1.9.8-linux-i686' |
I update this gist to v1.9.8. For lazy ones like us. I attached install_phantomjs.sh script. Have fun! |
Works perfectly, many thanks! |
Thanks! |
Awesome |
Great stuff, thanks. |
Thanks ! |
Thanks! |
install_phantomjs.sh - Works like charm, Thanks! |
Thank you. Works fine, tested on EC2 with Ubuntu 14.04. |
thanks! |
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. |
Thanks a ton!!! |
Thank you! For fonts issue I have to install ttf-mscorefonts-installer too. |
Amazingly simple <3 |
Thank you very much man! |
for Ubuntu14.04 and Mint v//carlosdeoliveira.guru change the version from 1.9.7 to 1.9.8 |
Thanks ftcosta |
Thanks. Works like a sharm ;-) |
npm install phantomjs -g |
pankajclabs, I know that feel buddy, when no one helps out |
Thank you |
The solution is so complex that I prefer using php -S localhost:80 for simple tests. |
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. |
Thanks for this! |
Thank you! Just installed it in vagrant and it works. |
Thank you! It works |
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 |
Thanks for This |
Thanks for this. It worked for me. |
Thanks, thanks, thanks, -- nando |
on Ubuntu 14.04 apt-get install phantomjs installs version 1.9.0-1 successfully for me. |
Thank you very much =) |
works! Thanks! |
amazing stuff! Thanks so much! Have been trying to figure this out for quite some time now |
Awesome!! |
worked, Thank You |
nice |
thanks |
Thanks |
Just completed successfully with version 2.1.1, thanks! |
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! |
Thanks a lot! |
Thanks! :-) |
Thanks |
Thanks :) |
Thanks |
Thanks a lot friend :) |
Thanks! |
Thanks! Very helpful |
Thanks!!! |
Great! Thank you very much! |
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! |
Thanks for the simple guide! |
Brilliant. |
Thanks :) |
Thanks. |
wget from Bitbucket sometimes results in a '20 redirection exceeded' error.I would wget from github instead ( and get a newer version and thanks for this Gist |
Thanks for the Gist! |
My sincere thanks. Heaps of instructions on the web but only yours works to me perfectly. |
Thanks for sharing. |
Thanks! |
how can i uninstall phantomjs? |
Thank you! |
Great script.. but this working curl command that worked for mesudo 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 |
thanks for the gist. but https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 is dead |
So this is the updated script for 2.1.1 and the new tarball url |
Thank you for the gist |
@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/ |
Good stuff |
Thanks @mathieujobin |
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. |
Thanks @mikesten and @loretoparisi -- the bitbucket URL for wget does work for me. |
Second to @mikesten comment on @loretoparisi 's script
Other than than the script works perfectly. |
what about : sudo apt-get install phantomjs |
Thanks @loretoparisi and @mikesten for the updated script, works great! |
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':'registernglobal code'} |
The other update for 2.1.1 had issues, I modified the script below: |
If this script has to be run through a sudo, why the sudo lines at the end ? It's redundant.. Prefer : @julionc nice and very useful gist :-) |
Thanks. Worked for me! |
Для тех, кто мучается установкой 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/ |
Worked here as well, thanks for a wonderful thread! |
Worked perfectly ! Thanks !! |
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 |
very helpful! Thanks ;) |
Thanks! |
PhantomJS is on npm. You can run this command to install it globally: npm install -g phantomjs-prebuilt |
Perfect! thank a lot!! |
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. |
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) |
Awesome! |
Thank you so much !!!! @janipaijanen. |
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 |
Thanks a lot! |
Thank a lot! I do some modification from your script for dockerizing purpose |
Cool Thanks |
You saved me! |
Why the fixed version though? PhantomJS has been updated, the currently version is 2.1.1. |
Thank you very much. working now |
Thanks |
replace: > sudo tar xvjf phantomjs-1.9.2-linux-x86_64.tar.bz2 with: > sudo tar xvjf $PHANTOM_JS.tar.bz2 |
node install.js
6381 verbose stack Exit status 1 6381 verbose stack at EventEmitter. (C:Program Filesnodejsnode_modulesnpmlibutilslifecycle.js:213:16) 6381 verbose stack at EventEmitter.emit (events.js:110:17) 6381 verbose stack at ChildProcess. (C:Program Filesnodejsnode_modulesnpmlibutilsspawn.js:14:12) 6381 verbose stack at ChildProcess.emit (events.js:110:17) 6381 verbose stack at maybeClose (child_process.js:1008:16) 6381 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1080:5)