An accurate clock matters more than it seems: TLS certificates, two-factor codes, database replication and logs all depend on it. The time zone decides how times are displayed and when cron jobs run.
1. Check the current settings
timedatectlLook at Time zone and System clock synchronized. It should say yes.
2. Choose a time zone
Many admins keep servers on UTC, which never changes for daylight saving and makes logs from different servers easy to compare. If you prefer local time, find your zone:
timedatectl list-timezones | grep -i europeThen set it:
sudo timedatectl set-timezone UTC
sudo timedatectl set-timezone Europe/Berlin # or a local zone3. Keep the clock in sync
Ubuntu and Debian: systemd-timesyncd
Ubuntu uses systemd-timesyncd out of the box. Some Debian 12 minimal images do not include it:
sudo apt install -y systemd-timesyncd
sudo timedatectl set-ntp true
timedatectl timesync-statusAlmaLinux and Rocky Linux: chrony
sudo dnf install -y chrony
sudo systemctl enable --now chronyd
chronyc tracking
chronyc sources -vchronyc tracking shows the current offset. A few milliseconds is normal.
Note: Run only one time service. If chrony is installed on Ubuntu or Debian, it replaces systemd-timesyncd, which is fine; just do not try to run both.
4. Restart services that read the time zone
Cron reads the time zone when it starts. After changing it, restart cron so jobs run at the times you expect:
sudo systemctl restart cron # Ubuntu / Debian
sudo systemctl restart crond # AlmaLinux / Rocky LinuxApplications can have their own setting too, for example date.timezone in PHP or the TZ environment variable for Node.js and Python apps.
Troubleshooting
- "System clock synchronized: no": check outgoing UDP port 123 is not blocked by your own firewall rules, then restart the time service.
- Times in logs look wrong after a change: services started before the change keep the old zone until restarted. A reboot fixes them all at once.
- Large clock jump on start: chrony steps the clock only in the first updates (
makestepin/etc/chrony.conf); later it adjusts gradually.
