# Chrony for Ubuntu 24.04 Server [![OS](https://img.shields.io/badge/ubuntu-24.04-E95420)](#) [![Shell](https://img.shields.io/badge/shell-bash-121011)](#) [![Service](https://img.shields.io/badge/service-chrony-2C3E50)](#) [![Time](https://img.shields.io/badge/feature-time_sync-0078D7)](#) [![License](https://img.shields.io/badge/License-MIT-green)](./LICENSE) Install Chrony on Ubuntu 24.04 server. This isn't a demo - This installer is intended for real servers. If you want ntpd nostalgia, this is NOT your script. --- ## Why this installer exists Ubuntu 24.04 retired `ntpd`, `ntpdate`, and `systemd-timesyncd` as primary time sync mechanisms. Chrony is now the only supported, sane, and future-proof NTP client. This installer: - Follows Canonical’s current direction - Avoids deprecated packages and aliases - Gives you deterministic, predictable time sync --- ## What this installer does ✔ Installs Chrony (Ubuntu default) ✔ Enables and starts the Chrony service ✔ Configures pool.ntp.org servers explicitly ✔ Forces an initial clock sync (`makestep`) ✔ Leaves legacy NTP components untouched (because they shouldn’t exist) --- ## What this installer does NOT do It won’t stop you from running the script without reading the documentation like there’s no tomorrow. Skip the README, and whatever happens next is your headache, not a bug report. --- ## 1. Prepare the system ``` sudo apt update -y ``` --- ## 2. Download ``` git clone https://git.x-files.dk/server/chrony-ubuntu.git ``` ``` cd chrony-ubuntu ``` --- ## 3. Install ``` sudo ./chrony-install ``` This configures the machine to use reliable upstream time servers and enables sync automatically. --- ## 4. Verify Synchronization ``` chronyc sources -v ``` If the peers list is present and updating — you're synced and good to go. --- ## Post-Install Nothing else required — time sync is automatic. --- ## Client vs Server mode (important) This installer always installs **Chrony**, which on Ubuntu 24.04 replaces both: - legacy `ntp-client` - legacy `ntpd` server setups ### Default behavior (Client only) Out of the box, Chrony runs in **client-only mode**: - Syncs time from upstream servers - Does **not** serve time to other machines - Does **not** listen on UDP/123 This is the functional equivalent of an old “NTP client” setup. ### Optional: Serve time to other machines (LAN / offline networks) If this machine should also act as a **local NTP server**, only **two lines** are required in `/etc/chrony/chrony.conf`: ``` allow 192.168.0.0/24 local stratum 10 ``` What these lines do: - `allow` — permits NTP clients from the specified network - `local stratum 10` — provides a safe fallback clock if upstream sources disappear Restart Chrony: ``` systemctl restart chrony ``` If a firewall is enabled: ``` ufw allow from 192.168.0.0/24 to any port 123 proto udp ``` Chrony will now act as **both client and server**, fully replacing the Ubuntu 22.04 NTP server pattern. --- ### More Information More guides and documentation can be found on [wiki.x-files.dk](https://wiki.x-files.dk) --- ### License Licensed under the [MIT License](./LICENSE). ---