How To Install sntp on Ubuntu 18.04

In this tutorial we learn how to install sntp on Ubuntu 18.04. sntp is Network Time Protocol - sntp client

Introduction

In this tutorial we learn how to install sntp on Ubuntu 18.04.

What is sntp

sntp is:

NTP, the Network Time Protocol, is used to keep computer clocks accurate by synchronizing them over the Internet or a local network, or by following an accurate hardware receiver that interprets GPS, DCF-77, NIST or similar time signals.

sntp can be used as an SNTP client to query a NTP or SNTP server and either display the time or set the local system’s time. It is not sufficient, however, for maintaining an accurate clock in the long run.

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

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

sudo apt-get update

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

sudo apt-get -y install sntp

Install sntp Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install sntp using apt by running the following command:

sudo apt -y install sntp

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

sudo aptitude -y install sntp

How To Uninstall sntp on Ubuntu 18.04

To uninstall only the sntp package we can use the following command:

sudo apt-get remove sntp

Uninstall sntp And Its Dependencies

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

sudo apt-get -y autoremove sntp

Remove sntp Configurations and Data

To remove sntp configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge sntp

Remove sntp configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge sntp

References

Summary

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