Skip to content

How to Install PhantomJS on CentOS & Fedora

Advertisement

PhantomJS is a headless WebKit scriptable with a JavaScript API. This is helpful for testing webpages on the command line. This tutorial will help to install FantomJS on CentOS, RHEL, and Fedora systems. Essentially there is no installation required. You just need to download the static build of PhantomJS and configure on your system.

Step 1 – Prerequsities

First, of all, you need to install the required packages needed by PhantomJS to work correctly.

RedHat 8 & Fedora Users

sudo dnf install glibc fontconfig freetype freetype-devel fontconfig-devel wget bzip2

CentOS 7/6 Users:

sudo yum install glibc fontconfig freetype freetype-devel fontconfig-devel wget bzip2

Step 2 – Install 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:

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

Step 3 – Verify 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

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

1 Comment

Leave a Reply

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


Back to top