How to install PhantomJS on Ubuntu 22.10

PhantomJS is a headless web browser for automating web page interactions.

To install PhantomJS on Ubuntu 22.10, you can follow these steps:

  • Update your system packages with sudo apt update && sudo apt upgrade
  • Install the required packages with sudo apt install build-essential chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
  • Download the PhantomJS binary file from its official website with wget
  • Extract the file to /usr/local/share/ with sudo tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/
  • Create a symbolic link to the binary file with sudo ln -sf /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
  • Verify the installation with phantomjs --version