We at YodiYil believe in trying new ideas and sharing our learning, data and results. We proactively document and share our resources in the form of tutorials for anyone to use or contribute to.
It is very important to set your server's time and timezone correct to ensure that your application or services work seamlessly with accurate timestamps. In this tutorial we will show you how to configure and set the timezone on an Ubuntu 18.04 server.
Step 1 Get the list of timezones
timedatectl list-timezones
Step 2 Set the timezone
sudo timedatectl set-timezone America/New_York
(replace America/New_York with your preferred timezone)
If you work with GPS Trackers and are setting up a GPS Tracking or IOT server that will collect data from multiple IOT devices or trackers, most trackers requires the timezone for your server to be set to UTC you can do so with the following command.
sudo timedatectl set-timezone UTC
Step 3 Verify or check the timezone that has been set
timedatectl
Example Output:
root@server:~# timedatectl Local time: Thu 2020-07-23 21:30:05 UTC Universal time: Thu 2020-07-23 21:30:05 UTC RTC time: Thu 2020-07-23 21:30:06 Time zone: UTC (UTC, +0000) System clock synchronized: yes systemd-timesyncd.service active: yes RTC in local TZ: no
Additionally you can also enable NTP Synchronization by running the following commands
sudo apt-get update
sudo apt-get install ntp