How To Install libarchive-dev on Ubuntu 20.04

In this tutorial we learn how to install libarchive-dev on Ubuntu 20.04. libarchive-dev is Multi-format archive and compression library (development files)

Introduction

In this tutorial we learn how to install libarchive-dev on Ubuntu 20.04.

What is libarchive-dev

libarchive-dev is:

The libarchive library provides a flexible interface for reading and writing archives in various formats such as tar and cpio. libarchive also supports reading and writing archives compressed using various compression filters such as gzip and bzip2. The library is inherently stream-oriented; readers serially iterate through the archive, writers serially add things to the archive.

Archive formats supported are:

* tar (read and write, including GNU extensions)
* pax (read and write, including GNU and star extensions)
* cpio (read and write, including odc and newc variants)
* iso9660 (read and write, including Joliet and Rockridge extensions, with
  some limitations)
* zip (read only, with some limitations, uses zlib)
* mtree (read and write)
* shar (write only)
* ar (read and write, including BSD and GNU/SysV variants)
* empty (read only; in particular, note that no other format will accept an
  empty file)
* raw (read only)
* xar (read only)
* rar (read only, with some limitations)
* 7zip (read and write, with some limitations)

Filters supported are:

* gzip (read and write, uses zlib)
* bzip2 (read and write, uses bzlib)
* compress (read and write, uses an internal implementation)
* uudecode (read only)
* separate command-line compressors with fixed-signature auto-detection
* xz and lzma (read and write using liblzma)
* zstandard (read and write using libzstd)

This package provides the files necessary for development with libarchive.

There are three methods to install libarchive-dev 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 libarchive-dev Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install libarchive-dev

Install libarchive-dev Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libarchive-dev

Install libarchive-dev 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 libarchive-dev using aptitude by running the following command:

sudo aptitude -y install libarchive-dev

How To Uninstall libarchive-dev on Ubuntu 20.04

To uninstall only the libarchive-dev package we can use the following command:

sudo apt-get remove libarchive-dev

Uninstall libarchive-dev And Its Dependencies

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

sudo apt-get -y autoremove libarchive-dev

Remove libarchive-dev Configurations and Data

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

sudo apt-get -y purge libarchive-dev

Remove libarchive-dev configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libarchive-dev

References

Summary

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