Skip to main content

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

Comment out any existing NTP pool servers, then to specify a single server instead of an NTP pool, use the following line in the configuration:

server <ip_address> iburst

If you want Chrony to act as an NTP server, add the following lines to the end of the config file (adjust the network address or add more allow entries as needed):

# Use this as an NTP server
allow 0.0.0.0/0

Restart the Chrony service with:

sudo service chrony restart

You can force Chrony to sync time immediately with the following command:

sudo chronyd -q

You can check the status of Chrony with the following commands:

chronyd -Q
chronyc activity
chronyc tracking
chronyc sources
chronyc sourcestats