How To Install libnss-resolve on Ubuntu 18.04

In this tutorial we learn how to install libnss-resolve on Ubuntu 18.04. libnss-resolve is nss module to resolve names via systemd-resolved

Introduction

In this tutorial we learn how to install libnss-resolve on Ubuntu 18.04.

What is libnss-resolve

libnss-resolve is:

nss-resolve is a plugin for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc) providing DNS and LLMNR resolution to programs via the systemd-resolved daemon (provided in the systemd package).

Installing this package automatically adds resolve to /etc/nsswitch.conf.

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

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

sudo apt-get update

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

sudo apt-get -y install libnss-resolve

Install libnss-resolve Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libnss-resolve

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

sudo aptitude -y install libnss-resolve

How To Uninstall libnss-resolve on Ubuntu 18.04

To uninstall only the libnss-resolve package we can use the following command:

sudo apt-get remove libnss-resolve

Uninstall libnss-resolve And Its Dependencies

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

sudo apt-get -y autoremove libnss-resolve

Remove libnss-resolve Configurations and Data

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

sudo apt-get -y purge libnss-resolve

Remove libnss-resolve configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge libnss-resolve

References

Summary

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