UbuntuUbuntu Based

How To Install NTP on Ubuntu 22.04 LTS

Install NTP on Ubuntu 22.04

In this tutorial, we will show you how to install NTP on Ubuntu 22.04 LTS. For those of you who didn’t know, NTP is a client-server-based protocol that is used to synchronize the time between different devices on a network. The NTP server keeps track of time using its clock source and then distributes this time to NTP clients on the network. The NTP client receives the time from the NTP server and adjusts its clock accordingly.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the NTP on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for NTP.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install NTP on Ubuntu 22.04 LTS Jammy Jellyfish

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade
sudo apt install wget apt-transport-https gnupg2 software-properties-common

Step 2. Installing NTP on Ubuntu 22.04.

NTP is readily available in the Ubuntu repository. To install it, open a terminal and run the following command below:

sudo apt install ntp

Once the installation is complete, NTP will be automatically started, and it will synchronize the system clock with the default NTP server pool.

Step 3. Configuring NTP Server.

In some cases, you may want to configure your Ubuntu 22.04 system to act as an NTP server. This is particularly useful in a network environment where you have many devices that need to synchronize their time with a central server.

To configure your Ubuntu 22.04 system as an NTP server, you need to edit the NTP configuration file located at /etc/ntp.conf. Open the file using your preferred text editor:

nano /etc/ntp.conf

Install NTP on Ubuntu 22.04 LTS Jammy Jellyfish

If you’re looking to optimize the accuracy and reliability of your network time synchronization, it may be a good idea to switch to NTP server pools that are geographically closer to your location. The NTP Pool Project website is a great resource to help you find the closest NTP server pool. To demonstrate, let’s say you’re in Singapore and want to update your NTP configuration files with a list of nearby servers. You can easily replace the default NTP pool list in the configuration files with the new servers from the NTP Pool Project website.

Next, restart the NTP service for the changes to take effect:

sudo systemctl restart ntp

Step 4. Configuring NTP Client.

If you have other devices on your network that need to synchronize their time with the Ubuntu 22.04 NTP server, you need to configure them as NTP clients.

To configure an NTP client, you need to edit the NTP configuration file located at /etc/ntp.conf. Open the file using your preferred text editor:

nano /etc/ntp.conf

Add the following line:

server (your-ntp-server-ip)

Save and close the file, then restart the NTP service for the changes to take effect:

sudo systemctl restart ntp

Step 5. Verify NTP Synchronization.

After configuring and restarting the NTP service, we can verify that the system is synchronized with the NTP server. Run the following command to check the status of the NTP service:

ntpq -p

This command will display a list of NTP servers and their synchronization status. If your system is properly synchronized, you should see an asterisk (*) next to the NTP server you added to the ntp.conf file.

Congratulations! You have successfully installed NTP. Thanks for using this tutorial for installing the NTP on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official NTP website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!
Back to top button