How To Install phantomjs on Debian 9

In this tutorial we learn how to install phantomjs on Debian 9. phantomjs is minimalistic headless WebKit-based browser with JavaScript API

Introduction

In this tutorial we learn how to install phantomjs on Debian 9.

What is phantomjs

phantomjs is:

PhantomJS is a headless WebKit with JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

PhantomJS is an optimal solution for headless testing of web-based applications, site scraping, pages capture, SVG renderer, PDF converter and many other use cases.

There are three methods to install phantomjs on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install phantomjs Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install phantomjs using apt-get by running the following command:

sudo apt-get -y install phantomjs

Install phantomjs Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install phantomjs using apt by running the following command:

sudo apt -y install phantomjs

Install phantomjs Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install phantomjs using aptitude by running the following command:

sudo aptitude -y install phantomjs

How To Uninstall phantomjs on Debian 9

To uninstall only the phantomjs package we can use the following command:

sudo apt-get remove phantomjs

Uninstall phantomjs And Its Dependencies

To uninstall phantomjs and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove phantomjs

Remove phantomjs Configurations and Data

To remove phantomjs configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge phantomjs

Remove phantomjs configuration, data, and all of its dependencies

We can use the following command to remove phantomjs configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge phantomjs

Dependencies

phantomjs have the following dependencies:

References

Summary

In this tutorial we learn how to install phantomjs package on Debian 9 using different package management tools: apt, apt-get and aptitude.