This post will cover installing PhantomJS on cPanel with root access.
The documentation at http://phantomjs.org/build.html is all that is needed.
I am only blogging this to let others know it did not break my cPanel server.
1. Download and install the dependencies
I already had openssl-devel, make, gcc, abd gcc-c++
1 2 |
[root@demos opt]# yum -y install flex bison gperf ruby freetype-devel fontconfig-devel libicu-devel sqlite-devel libpng-devel libjpeg-devel openssl-devel, make, gcc, abd gcc-c++ [root@demos opt]# service httpd start |
2. Download and unzip latest source code from http://phantomjs.org/download.html
1 2 |
[root@demos opt]# wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-source.zip [root@demos opt]# unzip -q phantomjs-2.0.0-source.zip |
3. Enter the phantomjs-2.0.0 directory and run ‘./build’;
1 |
[root@demos phantomjs-2.0.0]# ./build.sh |
You will see a notice saying it will 30 minutes to several hours. It only took about 20 minutes on my server.
When build completes and you are still in the phantomjs-2.0.0 directory, you can run ‘bin/phantomjs’ to test and you should get a prompt.
4. Create a symlink to put phantomjs in everyone’s path:
1 |
[root@demos phantomjs-2.0.0]# ln -s /opt/phantomjs-2.0.0/bin/phantomjs /usr/bin/phantomjs |
As stated in the documentation at
“This produces a build bin/phantomjs. This is an executable; it can be moved to a different directory (e.g. /usr/local/bin) or another machine.”
So you could just move it to /usr/bin as well.