Skip to main content

How to install PhantomJS on Ubuntu 18.04 LTS

PhantomJS is a headless WebKit scriptable with a JavaScript API.

It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

PhantomJS is an optimal solution for Headless Website Testing, Screen Capture, Page Automation and Network Monitoring.

There can be several ways of installing PhantomJS on Ubuntu 18.04:

Install PhantomJS on Ubuntu 18.04 LTS using Terminal

Step 1: Update Package List

$ sudo apt-get update

Step 2: Install following Libs

$ 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

Step 3: Export File

$ export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"

Step 4: Download file

$ wget$PHANTOM_JS.tar.bz2

Step 5: Extract file

$ sudo tar xvjf $PHANTOM_JS.tar.bz2

Step 6: Move to share directory

$ sudo mv $PHANTOM_JS /usr/local/share

Step 7:

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

Step 8: Check Installed Version

$ phantomjs --version
Submitted by tgoswami on September 18, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.