How To Install chrony on Ubuntu 22.04

In this tutorial we learn how to install chrony on Ubuntu 22.04. chrony is Versatile implementation of the Network Time Protocol

Introduction

In this tutorial we learn how to install chrony on Ubuntu 22.04.

What is chrony

chrony is:

It consists of a pair of programs:

chronyd: This is a daemon which runs in background on the system. It obtains measurements (e.g. via the network) of the system’s offset relative to other systems and adjusts the system time accordingly. For isolated systems, the user can periodically enter the correct time by hand (using ‘chronyc’). In either case ‘chronyd’ determines the rate at which the computer gains or loses time, and compensates for this. Chronyd implements the NTP protocol and can act as either a client or a server.

chronyc: This is a command-line driven control and monitoring program. An administrator can use this to fine-tune various parameters within the daemon, add or delete servers etc whilst the daemon is running.

There are three methods to install chrony on Ubuntu 22.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 chrony Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install chrony

Install chrony Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install chrony

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

sudo aptitude -y install chrony

How To Uninstall chrony on Ubuntu 22.04

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

sudo apt-get remove chrony

Uninstall chrony And Its Dependencies

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

sudo apt-get -y autoremove chrony

Remove chrony Configurations and Data

To remove chrony configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge chrony

Remove chrony configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge chrony

References

Summary

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