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:
1 2 3 4 5 6 7 8 9 10 11 12 | 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 cd /opt wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 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 |
phantomjs –version should report the version that you have installed.
Thanks!
Very helpful. Was able to get PhantomJS running. Saw lots of posts but this is the only post with the exact lines and depencies needed. Thanks a million
Glad to know it still works, took a fair amount of research to figure this out.