Phantomjs on Ubuntu linux can be installed using apt-get or node npm. It can also be downloaded from phantomjs site. We’ll use npm to install phantomjs in this tutorial. Here are the steps to install phantomjs on Ubuntu Linux.
- First install node and npm on Ubuntu if not already installed.
-
Get info about phantomjs package
$ npm info phantomjs { name: 'phantomjs', description: 'Headless WebKit with JS API', 'dist-tags': { latest: '2.1.3', alpha: '2.0.0-alpha' }, ... ...
-
Install phantomjs using npm in global mode
$ sudo npm install -g phantomjs $ npm ls -g | grep phantomjs ├─┬ phantomjs@2.1.3
-
Check if phantomjs is working
$ phantomjs --version 2.1.1
-
Check where is phantomjs installed
$ which phantomjs /usr/bin/phantomjs $ ls -l /usr/bin/phantomjs lrwxrwxrwx 1 root root 43 Jan 23 08:23 /usr/bin/phantomjs -> ../lib/node_modules/phantomjs/bin/phantomjs