How to install Phantomjs 2.1.1 on CentOS 7.6

Installation of Phantomjs 2.1.1 on CentOS 7.6

Pre-requisites:

Fontconfig

freetype

freetype-devel

fontconfig-devel

libstdc++

Download link :

Click here to download Phantomjs 2.1.1

Installation Procedure:

Install the pre-requisites packages by executing the following command.

[root@linuxhelp ~]# yum install fontconfig freetype freetype-devel fontconfig-devel libstdc++
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.estointernet.in
 * epel: epel.scopesky.iq
 * extras: mirrors.viethosting.com
 * remi-php72: ftp.riken.jp
 * remi-safe: ftp.riken.jp
 * updates: centos.mirrors.estointernet.in
Package fontconfig-2.13.0-4.3.el7.x86_64 already installed and latest version
Package freetype-2.8-12.el7_6.1.x86_64 already installed and latest version
Resolving Dependencies
.
.
.
Installed:
  fontconfig-devel.x86_64 0:2.13.0-4.3.el7          freetype-devel.x86_64 0:2.8-12.el7_6.1         

Dependency Installed:
  expat-devel.x86_64 0:2.1.0-10.el7_3                libpng-devel.x86_64 2:1.5.13-7.el7_2          
  libuuid-devel.x86_64 0:2.23.2-59.el7_6.1           zlib-devel.x86_64 0:1.2.7-18.el7              

Updated:
  libstdc++.x86_64 0:4.8.5-36.el7_6.2                                                               

Dependency Updated:
  libblkid.x86_64 0:2.23.2-59.el7_6.1                libmount.x86_64 0:2.23.2-59.el7_6.1           
  libsmartcols.x86_64 0:2.23.2-59.el7_6.1            libuuid.x86_64 0:2.23.2-59.el7_6.1            
  util-linux.x86_64 0:2.23.2-59.el7_6.1             

Complete!

Download the latest version of phantomjs 2.1.1 using wget.

[root@linuxhelp ~]# wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
--2019-05-23 11:01:29--  https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
Resolving bitbucket.org (bitbucket.org)... 18.205.93.1, 18.205.93.0, 18.205.93.2, ...
Connecting to bitbucket.org (bitbucket.org)|18.205.93.1|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://bbuseruploads.s3.amazonaws.com/fd96ed93-2b32-46a7-9d2b-ecbc0988516a/downloads/396e7977-71fd-4592-8723-495ca4cfa7cc/phantomjs-2.1.1-linux-x86_64.tar.bz2?Signature=2gXWps3vFPqs%2FFnz7%2FfSQUDJJCo%3D&Expires=1558590755&AWSAccessKeyId=AKIAIQWXW6WLXMB5QZAQ&versionId=null&response-content-disposition=attachment%3B%20filename%3D%22phantomjs-2.1.1-linux-x86_64.tar.bz2%22 [following]
--2019-05-23 11:01:30--  https://bbuseruploads.s3.amazonaws.com/fd96ed93-2b32-46a7-9d2b-ecbc0988516a/downloads/396e7977-71fd-4592-8723-495ca4cfa7cc/phantomjs-2.1.1-linux-x86_64.tar.bz2?Signature=2gXWps3vFPqs%2FFnz7%2FfSQUDJJCo%3D&Expires=1558590755&AWSAccessKeyId=AKIAIQWXW6WLXMB5QZAQ&versionId=null&response-content-disposition=attachment%3B%20filename%3D%22phantomjs-2.1.1-linux-x86_64.tar.bz2%22
Resolving bbuseruploads.s3.amazonaws.com (bbuseruploads.s3.amazonaws.com)... 52.216.184.243
Connecting to bbuseruploads.s3.amazonaws.com (bbuseruploads.s3.amazonaws.com)|52.216.184.243|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23415665 (22M) [application/x-tar]
Saving to: ‘phantomjs-2.1.1-linux-x86_64.tar.bz2’

100%[==========================================================>] 23,415,665   967KB/s   in 42s    

2019-05-23 11:02:14 (541 KB/s) - ‘phantomjs-2.1.1-linux-x86_64.tar.bz2’ saved [23415665/23415665]

Move the downloaded phantomjs file to opt directory.

[root@linuxhelp ~]# mv phantomjs-2.1.1-linux-x86_64.tar.bz2 /opt

Change the directory to /opt directory.

[root@linuxhelp ~]# cd /opt

List the contents to view the moved tar file of phantomjs.

[root@linuxhelp opt]# ll
total 22868
-rw-r--r--  1 root root 23415665 Jan 25  2016 phantomjs-2.1.1-linux-x86_64.tar.bz2
drwxr-xr-x. 2 root root        6 Oct 31  2018 rh

Extract the tar file of phantomjs as follows.

 [root@linuxhelp opt]# tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2
phantomjs-2.1.1-linux-x86_64/
phantomjs-2.1.1-linux-x86_64/examples/
phantomjs-2.1.1-linux-x86_64/examples/colorwheel.js
phantomjs-2.1.1-linux-x86_64/examples/scandir.js
.
.
.
.
phantomjs-2.1.1-linux-x86_64/LICENSE.BSD
phantomjs-2.1.1-linux-x86_64/bin/
phantomjs-2.1.1-linux-x86_64/bin/phantomjs
phantomjs-2.1.1-linux-x86_64/third-party.txt
phantomjs-2.1.1-linux-x86_64/ChangeLog

Creata a Symlink in the /usr/local/bin location for phantomjs.

 [root@linuxhelp opt]# ln -s /opt/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/

Check the version of phantomjs.

 [root@linuxhelp opt]# phantomjs --version
2.1.1

With this, the installation of Phantomjs 2.1.1v On CentOS 7.6 comes to end.

FAQ
Q
What are the tools that phantomjs use?
A
CasperJS and YSlow are the tools that phantomjs use.
Q
What does page Automation mean in phantomjs 2.1.1?
A
phantomjs 2.1.1 used to load and manipulate a web page which helps developers to run a bunch of tests without ever opening the web browser.
Q
What is phantomjs 2.1.1 used for?
A
Phantomjs 2.1.1 is used for many purposes like screen capture, Page automation, Network monitoring, and testing.
Q
Is Phantomjs 2.1.1 usable to surf the web?
A
Phantomjs 2.1.1 is not used to surf the web
Q
What is phantomjs 2.1.1?
A
phantomjs 2.1.1 is a web browser without a graphical user interface.