How To Install libnss-myhostname on Ubuntu 20.04

In this tutorial we learn how to install libnss-myhostname on Ubuntu 20.04. libnss-myhostname is nss module providing fallback resolution for the current hostname nss module providing fallback resolution for the current hostname

Introduction

In this tutorial we learn how to install libnss-myhostname on Ubuntu 20.04.

What is libnss-myhostname

libnss-myhostname is:

This package contains a plugin for the Name Service Switch, providing host name resolution for the locally configured system hostname as returned by gethostname(2). It returns all locally configured public IP addresses or – if none are configured, the IPv4 address 127.0.1.1 (which is on the local loopback) and the IPv6 address ::1 (which is the local host).

A lot of software relies on that the local host name is resolvable. This package provides an alternative to the fragile and error-prone manual editing of /etc/hosts.

Installing this package automatically adds myhostname to /etc/nsswitch.conf. Task: ubuntu-core

Package: libnss-myhostname Architecture: amd64 Version: 245.4-4ubuntu3 Multi-Arch: same Priority: extra Section: admin Source: systemd Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Debian systemd Maintainers [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 259 Depends: libc6 (>= 2.30) Filename: pool/main/s/systemd/libnss-myhostname_245.4-4ubuntu3_amd64.deb Size: 44252 MD5sum: 02ee394a01d6eb91abb6d3832facb6d9 SHA1: 347066abf6babf88cd7960e19b5d0c629dd3b4b8 SHA256: fc0162e006d22256c6a2bbdc94ec849bb72aacd34237a588ad5c4d484990da67 Homepage: https://www.freedesktop.org/wiki/Software/systemd Description-en: nss module providing fallback resolution for the current hostname This package contains a plugin for the Name Service Switch, providing host name resolution for the locally configured system hostname as returned by gethostname(2). It returns all locally configured public IP addresses or – if none are configured, the IPv4 address 127.0.1.1 (which is on the local loopback) and the IPv6 address ::1 (which is the local host).

A lot of software relies on that the local host name is resolvable. This package provides an alternative to the fragile and error-prone manual editing of /etc/hosts.

Installing this package automatically adds myhostname to /etc/nsswitch.conf. Task: ubuntu-core

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

sudo apt-get -y install libnss-myhostname

Install libnss-myhostname Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install libnss-myhostname

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

sudo aptitude -y install libnss-myhostname

How To Uninstall libnss-myhostname on Ubuntu 20.04

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

sudo apt-get remove libnss-myhostname

Uninstall libnss-myhostname And Its Dependencies

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

sudo apt-get -y autoremove libnss-myhostname

Remove libnss-myhostname Configurations and Data

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

sudo apt-get -y purge libnss-myhostname

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

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

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

References

Summary

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