How To Set Up Time Synchronization on Ubuntu 16.04
How To Set Up Time Synchronization on Ubuntu 16.04
Introduction
Time synchronization is important for the proper functioning of any system, and Ubuntu 16.04 comes with a built-in tool for synchronizing time called "systemd-timesyncd". In this tutorial, we will guide you through the process of setting up time synchronization on your Ubuntu 16.04 machine.
Prerequisites
- An Ubuntu 16.04 machine
- Root access or a user with sudo privileges
Step 1 - Enabling the systemd-timesyncd Service
The systemd-timesyncd service is disabled by default on Ubuntu 16.04, so we need to enable it first. To do this, open a terminal and enter the following command:
sudo timedatectl set-ntp true
Step 2 - Checking the Status of systemd-timesyncd
After enabling the systemd-timesyncd service, we need to check its status to make sure that it is running properly. Enter the following command:
systemctl status systemd-timesyncd
Step 3 - Configuring systemd-timesyncd
The systemd-timesyncd service is now running, but we may need to configure it further depending on our needs. We can do this by editing the "systemd-timesyncd.service" file. Enter the following command to open the file in a text editor:
sudo nano /lib/systemd/system/systemd-timesyncd.service
In the file, we can set the time servers to synchronize with by adding "NTP" servers to the "ExecStart=" line. For example:
ExecStart=/usr/lib/systemd/systemd-timesyncd --ntp- server=0.ubuntu.pool.ntp.org --ntp-server=1.ubuntu.pool.ntp.org --ntp-server=2.ubuntu.pool.ntp.org --ntp-server=3.ubuntu.pool.ntp.org
We can also set the time zone by adding "Timezone=" followed by the desired time zone. For example:
Timezone=America/New_York
After making any changes, save the file and exit the text editor.
Step 4 - Restarting systemd-timesyncd
After making changes to the "systemd-timesyncd.service" file, we need to restart the systemd-timesyncd service for the changes to take effect. Enter the following command:
sudo systemctl daemon-reload
sudo systemctl restart systemd-timesyncd
Conclusion
In this tutorial, we have shown you how to set up time synchronization on your Ubuntu 16.04 machine using the built-in "systemd-timesyncd" tool. By following the steps outlined in this tutorial, you can ensure that your system's time is accurate and synchronized with other servers.
Keywords: Ubuntu 16.04
Комментарии
Отправить комментарий