How To Install libcairo2-ocaml on Ubuntu 20.04

In this tutorial we learn how to install libcairo2-ocaml on Ubuntu 20.04. libcairo2-ocaml is OCaml binding for Cairo (runtime library)

Introduction

In this tutorial we learn how to install libcairo2-ocaml on Ubuntu 20.04.

What is libcairo2-ocaml

libcairo2-ocaml is:

This is an OCaml binding to Cairo, a 2D graphics library with support for multiple output devices. Currently supported output targets include the X Window System, Quartz, Win32, image buffers, PostScript, PDF, and SVG file output.

This package includes only the dynamic library needed for running dynamic OCaml bytecode executables that have been compiled with the cairo2 OCaml libraries.

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

Install libcairo2-ocaml Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install libcairo2-ocaml

Install libcairo2-ocaml Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libcairo2-ocaml

Install libcairo2-ocaml 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 Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install libcairo2-ocaml

How To Uninstall libcairo2-ocaml on Ubuntu 20.04

To uninstall only the libcairo2-ocaml package we can use the following command:

sudo apt-get remove libcairo2-ocaml

Uninstall libcairo2-ocaml And Its Dependencies

To uninstall libcairo2-ocaml and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove libcairo2-ocaml

Remove libcairo2-ocaml Configurations and Data

To remove libcairo2-ocaml configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge libcairo2-ocaml

Remove libcairo2-ocaml configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libcairo2-ocaml

References

Summary

In this tutorial we learn how to install libcairo2-ocaml package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.