How To Install libmnl-dev on Ubuntu 18.04

In this tutorial we learn how to install libmnl-dev on Ubuntu 18.04. libmnl-dev is minimalistic Netlink communication library (devel)

Introduction

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

What is libmnl-dev

libmnl-dev is:

libmnl is a minimalistic user-space library oriented to Netlink developers. There are a lot of common tasks in parsing, validating, constructing of both the Netlink header and TLVs that are repetitive and easy to get wrong. This library aims to provide simple helpers that allows you to re-use code and to avoid re-inventing the wheel.

The main features of this library are:

Small: the shared library requires around 30KB for an x86-based computer.

Simple: this library avoids complexity and elaborated abstractions that tend to hide Netlink details.

Easy to use: the library simplifies the work for Netlink-wise developers. It provides functions to make socket handling, message building, validating, parsing and sequence tracking, easier.

Easy to re-use: you can use the library to build your own abstraction layer on top of this library.

Decoupling: the interdependency of the main bricks that compose the library is reduced, i.e. the library provides many helpers, but the programmer is not forced to use them.

This package contains the development libraries and header files you need to develop your programs using the minimalistic Netlink communication library.

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

sudo apt-get -y install libmnl-dev

Install libmnl-dev Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libmnl-dev

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

sudo aptitude -y install libmnl-dev

How To Uninstall libmnl-dev on Ubuntu 18.04

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

sudo apt-get remove libmnl-dev

Uninstall libmnl-dev And Its Dependencies

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

sudo apt-get -y autoremove libmnl-dev

Remove libmnl-dev Configurations and Data

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

sudo apt-get -y purge libmnl-dev

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

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

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

References

Summary

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