Skip to content

How to Install PhantomJS on Ubuntu & Debian

How to Install PhantomJS on Ubuntu & Debian. Installation instruction to install phantomjs on Ubuntu, debian and LinuxMint systems

Steps
3
Covers
Debian, Ubuntu
On this page 3 steps

PhantomJS is a headless web browser for automating web page interactions. The PhantomJS development has been discontinued by their team till the next information. It’s good to switch to an alternative of Phantom.js.

The Phantom is available as ready to use binary. You just need to download the Phantomjs binary file and place it on your system available under the PATH environment. So it will be accessible throughout the system. This tutorial will help to set up FantomJS on Ubuntu and Debian systems.

Prerequisites

First, you should install or update system packages to the latest versions. Also, install the required packages needed by PhantomJS to work correctly.

Open a terminal and udpate Apt cache first:

sudo apt-get update 

Then install required packages:

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

Step 1 of 3Install FantomJS

Now download the latest FantomJS from its official website. After downloading the archive file, just extract this to the desired system location. You don’t need to install this.

wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 
tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/ 

Now simply create a soft link phantomjs binary file to systems bin dirctory as below:

sudo ln -sf /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin 

Step 3 of 3Verify FantomJS Version

After completing installation, let’s verify the installed version of phantomjs.

phantomjs --version 

2.1.1

You can also find the version details from PhantomJS prompt. To get PhantomJS prompt type “phantomjs” on shell prompt and you will get the prompt. Now type phantom.version to get version details.

phantomjs

phantomjs> phantom.version
{
   "major": 2,
   "minor": 1,
   "patch": 1
}
phantomjs>

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

7 Comments

  1. I have OpenSSL 1.1.1d on my Debian 13.1.0
    When I typed ‘phantomjs –version’ I got an error: Autoconfiguration failed
    The solution to open ‘/etc/ssl/openssl.cnf’ and comment out the line under ‘[default_conf]’ (it is at the end of the config file):
    ‘#ssl_conf = ssl_sect’

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top