Operating System Linux

Set the Time Zone and Check Time Sync on Ubuntu 26.04, Debian 13 and AlmaLinux 9

Set the time zone with timedatectl and confirm that time synchronisation is working on Ubuntu 26.04, Debian 13 and AlmaLinux 9.

This guide shows how to check and change the time zone of a Linux server and how to confirm that its clock is being kept accurate. It covers Ubuntu 26.04 and 24.04, Debian 13 and 12, and AlmaLinux 9, Rocky Linux 9 and CentOS Stream 9. All of them use the same tool, timedatectl, so the distribution-specific programs found in older tutorials, such as redhat-config-date and the text-mode setup utility on CentOS, are no longer needed.

Check the current settings

Run timedatectl without arguments. It needs no special rights:

timedatectl

The output looks like this:

               Local time: Sun 2026-11-15 14:47:12 UTC
           Universal time: Sun 2026-11-15 14:47:12 UTC
                 RTC time: Sun 2026-11-15 14:47:12
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Three lines matter most: Time zone is the configured zone, System clock synchronized says whether the clock has been set from a time server, and NTP service says whether a synchronisation service is running.

Change the time zone

Time zones are named after a region and a city. List them and filter for what you need:

timedatectl list-timezones | grep -i europe

Set the zone using the exact name from the list:

sudo timedatectl set-timezone Europe/Berlin

The change takes effect immediately and survives reboots; the command updates the /etc/localtime symbolic link. No reboot is required. Verify it:

timedatectl
date

date now prints the local time with the zone abbreviation, for example CET. Daylight saving changes are applied automatically from the time zone database, which is updated through the normal package updates (tzdata).

To go back to UTC:

sudo timedatectl set-timezone UTC

Restart long-running services

Programs read the time zone when they start. Services that were already running, such as cron, your syslog daemon, databases and application servers, keep using the old zone until they are restarted. Restart the ones whose timestamps or schedules matter to you, or reboot at a convenient time. Some applications also have their own setting that overrides the system zone, for example date.timezone in PHP or the time zone setting of a database server.

Debian and Ubuntu alternative

The menu-driven method still works on Debian and Ubuntu and has the same effect:

sudo dpkg-reconfigure tzdata

A different zone for one user or one command

The system zone is only a default. The TZ environment variable overrides it for a single command, or for a user if you export it in that user's ~/.profile:

TZ=America/New_York date

Check time synchronisation

The time zone only controls how time is displayed. Whether the clock itself is correct depends on a synchronisation service, and which one is installed differs by distribution:

DistributionDefault service
Ubuntu 26.04chrony (the default since Ubuntu 25.10)
Ubuntu 24.04systemd-timesyncd
Debian 13 and 12systemd-timesyncd
AlmaLinux 9, Rocky Linux 9, CentOS Stream 9chrony

A system upgraded from an older release, or built from a minimal image, may differ from the table. Check what is actually running:

systemctl is-active systemd-timesyncd chrony chronyd

Exactly one of the three lines should say active (the chrony unit is named chrony on Debian and Ubuntu and chronyd on the RHEL family).

With systemd-timesyncd

timedatectl timesync-status

This shows the server in use, the poll interval and the current offset. systemd-timesyncd is a simple SNTP client, which is sufficient for a typical server. Its servers are configured with the NTP= and FallbackNTP= lines in /etc/systemd/timesyncd.conf.

With chrony

chronyc tracking
chronyc sources

tracking reports the reference server and the remaining offset of the system clock; a Leap status of Normal means the clock is synchronised. In the sources list, the line marked ^* is the server currently selected. The configuration lives in /etc/chrony/chrony.conf on Ubuntu and Debian and in /etc/chrony.conf on the RHEL family.

On Ubuntu 26.04, chrony uses Network Time Security (NTS) with Ubuntu's time servers by default, which authenticates the time source. NTS needs outbound TCP port 4460 for the key exchange in addition to UDP port 123. To confirm that it is in use:

sudo chronyc -N authdata

The sources should show NTS in the Mode column.

If synchronisation is off

When timedatectl shows NTP service: inactive, enable the installed service:

sudo timedatectl set-ntp true

When it shows n/a, no synchronisation service is installed. Install one, not both. On Debian and Ubuntu:

sudo apt update
sudo apt install systemd-timesyncd

On AlmaLinux 9 and Rocky Linux 9:

sudo dnf install chrony
sudo systemctl enable --now chronyd

Give the service a minute, then run timedatectl again and look for System clock synchronized: yes.

Set the clock by hand

With working synchronisation you never need this. On a server without network access to any time source, switch synchronisation off first, because a manual change is otherwise refused, and then set the time:

sudo timedatectl set-ntp false
sudo timedatectl set-time "2026-11-15 14:30:00"

Leave the hardware clock in UTC

The last line of the timedatectl output, RTC in local TZ, should say no. Keeping the hardware clock in local time is, in the words of the manual, not fully supported and causes problems around time zone and daylight saving changes. If it says yes, switch it back:

sudo timedatectl set-local-rtc 0

Troubleshooting

  • "System clock synchronized: no" although the service is active: the server cannot reach its time sources. Allow outbound UDP port 123 (and TCP 4460 on Ubuntu 26.04 with NTS) in your firewall and in your provider's network firewall, then check timedatectl timesync-status or chronyc sources again.
  • "Failed to set time zone" with an access or authentication error: run the command with sudo.
  • "Invalid or not installed time zone": the name must match an entry of timedatectl list-timezones exactly, including capital letters.
  • The clock cannot be set inside a container: containers share the host's clock. The time zone can still be changed, but synchronisation is the host's job.
  • Cron jobs run at the old times: restart the cron service after changing the zone.

Frequently asked questions

Should a server run on UTC or on local time?

UTC is the common choice for servers: it has no daylight saving jumps, logs from machines in different locations line up, and scheduled jobs never run twice or get skipped when the clocks change. Use a local zone when the server mainly serves one region and people read its logs or schedule its jobs in local time.

Does changing the time zone alter existing log entries?

No. Text logs keep the timestamps that were written at the time, so entries before and after the change are in different zones. The systemd journal stores time internally in UTC and displays it in whatever zone is current when you read it.

Do I have to do anything for daylight saving time?

No. The rules are part of the time zone database. Keep the system updated so that changes to those rules, which governments make from time to time, reach your server.

What is the difference between the time zone and time synchronisation?

Synchronisation keeps the server's internal clock, which counts in UTC, accurate. The time zone is only a display rule applied on top of it. A server can be perfectly synchronised and show the "wrong" time simply because its zone is not the one you expected.

Share story:

Continue reading other guides on How VPS.