How To Install libcbor-xs-perl on Ubuntu 18.04

In this tutorial we learn how to install libcbor-xs-perl on Ubuntu 18.04. libcbor-xs-perl is module for manipulating CBOR-formatted data (C/XS-accelerated)

Introduction

In this tutorial we learn how to install libcbor-xs-perl on Ubuntu 18.04.

What is libcbor-xs-perl

libcbor-xs-perl is:

CBOR::XS converts Perl data structures to the Concise Binary Object Representation (CBOR) and vice versa. CBOR is a fast binary serialisation format that aims to use an (almost) superset of the JSON data model, i.e. when you can represent something useful in JSON, you should be able to represent it in CBOR.

In short, CBOR is a faster and quite compact binary alternative to JSON, with the added ability of supporting serialisation of Perl objects. (JSON often compresses better than CBOR though, so if you plan to compress the data later and speed is less important you might want to compare both formats first).

To give you a general idea about speed, with texts in the megabyte range, CBOR::XS usually encodes roughly twice as fast as Storable or JSON::XS and decodes about 15%-30% faster than those. The shorter the data, the worse Storable performs in comparison.

There are three methods to install libcbor-xs-perl on Ubuntu 18.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 libcbor-xs-perl Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install libcbor-xs-perl

Install libcbor-xs-perl Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libcbor-xs-perl using apt by running the following command:

sudo apt -y install libcbor-xs-perl

Install libcbor-xs-perl 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 libcbor-xs-perl using aptitude by running the following command:

sudo aptitude -y install libcbor-xs-perl

How To Uninstall libcbor-xs-perl on Ubuntu 18.04

To uninstall only the libcbor-xs-perl package we can use the following command:

sudo apt-get remove libcbor-xs-perl

Uninstall libcbor-xs-perl And Its Dependencies

To uninstall libcbor-xs-perl and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove libcbor-xs-perl

Remove libcbor-xs-perl Configurations and Data

To remove libcbor-xs-perl configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge libcbor-xs-perl

Remove libcbor-xs-perl configuration, data, and all of its dependencies

We can use the following command to remove libcbor-xs-perl configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge libcbor-xs-perl

References

Summary

In this tutorial we learn how to install libcbor-xs-perl package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.