Ubuntu Time Configuration
Setting the Time Zone
To check the current time zone set, run the following command:
timedatectl
To get a list of available time zones, run the following command:
timedatectl list-timezones
To set the timezone to one of the above time zones, run the following command (using Central time as an example):
sudo timedatectl set-timezone America/Chicago
Manually setting NTP server using TimeSyncD
If you need to manually configure an NTP server, edit the following configuration file:
sudo nano /etc/systemd/timesyncd.conf
Add the following line with spaces between each NTP server you want to sync with:
NTP=<ntp_server_1> <ntp_server_2>
Restart the time synchronization service with:
sudo service systemd-timesyncd restart
You can also check the status of the service with:
sudo service systemd-timesyncd status
Using Chrony instead of TimeSyncD
Install Chrony with the following command:
sudo apt install -y chrony
Edit the default Chrony config if you need to manually configure NTP servers with the following command:
sudo nano /etc/chrony/chrony.conf
To specify a single server instead of an NTP pool, use the following line in the configuration:
server <ip_address> iburst
Restart the Chrony service with:
sudo service chrony restart
You can force Chrony to sync time immediately with the following command:
sudo chronycchronyd makestep-q
You can check the status of Chrony with the following commands:
chronyc activity
chronyc tracking
chronyc sources
chronyc sourcestats