How To Install libosmium2-dev on Ubuntu 18.04

In this tutorial we learn how to install libosmium2-dev on Ubuntu 18.04. libosmium2-dev is C++ framework for working with OSM data files

Introduction

In this tutorial we learn how to install libosmium2-dev on Ubuntu 18.04.

What is libosmium2-dev

libosmium2-dev is:

The Osmium library has extensive support for all types of OSM entities: nodes, ways, relations, and changesets. It allows reading from and writing to OSM files in XML and PBF formats, including change files and full history files. Osmium can store OSM data in memory and on disk in various formats and using various indexes. Its easy to use handler interface allows you to quickly write data filtering and conversion functions. Osmium can create WKT, WKB, OGR, GEOS and GeoJSON geometries for easy conversion into many GIS formats and it can assemble multipolygons from ways and relations.

Osmium is a header-only library, so there is nothing to compile to build it. Just include the header files you need.

This package contains the Osmium library headers.

There are three methods to install libosmium2-dev 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 libosmium2-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 libosmium2-dev using apt-get by running the following command:

sudo apt-get -y install libosmium2-dev

Install libosmium2-dev Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libosmium2-dev

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

sudo aptitude -y install libosmium2-dev

How To Uninstall libosmium2-dev on Ubuntu 18.04

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

sudo apt-get remove libosmium2-dev

Uninstall libosmium2-dev And Its Dependencies

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

sudo apt-get -y autoremove libosmium2-dev

Remove libosmium2-dev Configurations and Data

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

sudo apt-get -y purge libosmium2-dev

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

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

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

References

Summary

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