We were upgrading our automated screen shot process of our core product, moving it over to phantomJS 2.0 as it uses a much newer QT WebKit engine, that produces far more accurate results.
However, there is currently no download for the linux build, so we decided to build it ourselves. After quite a few failed attempts, (using various bash scripts and trying the
deploy vm that is in the repo), this is how we finally got it working If you want to cut to the chase, you can grab the 64bit bin file here...
UPDATE: for compiling for AWS EC2 see here
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "CentOS_6.5_64" config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box" config.vm.synced_folder ".", "/home/vagrant/phantomjs/bin", owner:"root", group:"root", mount_options:["dmode=777","fmode=777"] end config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "4096"] end end
Save the above and call it
Vagrantfile. Then get your terminal up, and cd to the same dir.
Now spin up that server and ssh into it (the first time will take a while as it downloads the base vm image)...
vagrant up vagrant sshThen update yum and install dependencies...
sudo yum -y update sudo yum -y install gcc gcc-c++ make flex bison gperf ruby openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel libpng-devel libjpeg-devel
Checkout the repo, and switch to the 2.0 release
git clone git://github.com/ariya/phantomjs.git cd phantomjsNext we had to patch the 2.0 release with a bug fix
git checkout 2.0.0
curl -O https://patch-diff.githubusercontent.com/raw/ariya/phantomjs/pull/12899.patch git apply 12899.patchAnd finally run the build script.
It takes HOURS to compile, due to all the webkit dependencies. We did try spinning up with more CPU cores, and running the build script with more build jobs, but this always failed on us.
If you just want the bin from this build (64bit) then you can grab it here