Phantomjs is a useful tool for crawling / and or replicating web pages. The notable difference here between using curl or wget, is that phantomjs executes scripts while parsing the page, rather than simply rendering a static download. As such, scripts such as google analytics and all others will be executed with this request. Simply put, it is a scriptable, headless web browser. Very useful for traffic simulation or load testing…and other things.
It takes a little bit of googling to get this installed properly, so i have created this article as a result of my own research. DNF is required to install some of the required packages so i have included a command to install dnf with yum. This sample assumes you have enabled EPEL repositories as well; if not please do so before proceeding.
Let’s install it on a base Centos 7 install, same procedure for RHEL:
yum install -y dnf
dnf install -y glibc fontconfig
yum install -y lbzip2
yum install -y fontconfig
yum install -y freetype
yum install -y wget
yum install -y bzip2
tar -xvf phantomjs-2.1.1-linux-x86_64.tar.bz2
ln -s /opt/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
phantomjs –version should report the version that you have installed.