Set up NTP Server and Client on AlmaLinux 9 | Best Setup
In this guide, we aim to provide a comprehensive walkthrough on How To Set up NTP Server and Client on AlmaLinux 9. A ‘network time server’ is a general term for the software running on an NTP (Network Time Protocol) server, regardless of the underlying server/computer platform. It is also applied to network appliances (tray mount, rack, etc.) that obtain and use time from an external source to maintain accurate time within its local internal clock and then provide that time to the connected network. This synchronization is achieved using the NTP or Network Time Protocol.
You can now proceed to the guide steps below to complete NTP server and client setup on AlmaLinux 9.
To complete this guide, you must log in to your server as a non-root user and set up a basic firewall. To do this, you can follow our guide on Initial Server Setup with AlmaLinux 9.
1. Install Chrony on AlmaLinux 9
To implement NTP on your server, you need to have Chrony installed. Chrony is an implementation of the Network Time Protocol and is useful in several ways. It’s designed to synchronize the system clock faster and with better accuracy than ntpd
, especially useful for systems that are not continuously connected to the network.
First of all, check the current time zone of your server with the following timedatectl command:
timedatectl
Example output:
**Output**
Time zone: America/New_York (EDT, -0400)
Next, update your local package index with the following command:
sudo dnf update -y
Then, install Chrony on AlmaLinux 9 with the following command:
sudo dnf install chrony -y
Start and enable your Chrony service with the commands below:
# sudo systemctl start chronyd
# sudo systemctl enable chronyd
To verify that your Chrony service is active and running on your server, run the command below:
sudo systemctl status chronyd

2. Configure NTP Server on AlmaLinux 9
The default configuration file for the NTP server is /etc/chrony.conf
. First, you need to open the file with your favorite text editor, here we use vi:
sudo vi /etc/chrony.conf
In the file, comment out the Pool line by adding a #
at the beginning of the line. This prevents the server from using the default pool servers and allows you to specify your own.
Add a list of NTP servers close to your location. In my case, in the US, you can use the All pool server in the NTPPool website:
#pool 2.cloudlinux.pool.ntp.org iburst
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org
Also, you need to allow NTP client access from the local network. To do this, edit the line below, replacing the example network with your actual local network:
# Allow NTP client access from local network.
allow 192.168.201.0/24
When you are done, save and close the file.
In the next step, you need to set NTP synchronization with the following command:
sudo timedatectl set-ntp true
Restart your Chrony service to apply the changes:
sudo systemctl restart chronyd
Now you can check whether your NTP server is working or not with the following command:
chronyc sources

At this point, you need to allow NTP service through the AlmaLinux 9 firewall:
sudo firewall-cmd --permanent --add-service=ntp --permanent
Reload the firewall to apply the changes:
sudo firewall-cmd --reload
3. Configure NTP Client on AlmaLinux 9
At this point, you need to install the NTP client on a client machine and configure it with Chrony. First, you need to set the correct timezone on your client machine:
sudo timedatectl set-timezone America/New_York
Then, install Chrony on your client machine:
sudo dnf install chrony -y
Edit the configuration file /etc/chrony.conf
and point to your NTP server.
sudo vi /etc/chrony.conf
#pool 2.fedora.pool.ntp.org iburst
server your-server-ip-address
When you are done, save and close the file. Restart your Chrony service to apply the changes:
sudo systemctl restart chronyd
Next, set NTP synchronization:
sudo timedatectl set-ntp true
Enable your Chrony service to start on boot:
sudo systemctl enable chronyd
Now verify your time synchronization:
chronyc sources

Finally, you can check on NTP clients. To do this, log in to your AlmaLinux 9 server and run the command below:
sudo chronyc clients

That’s it, you are done. This detailed guide shows you the best setup for Set up NTP Server and Client on AlmaLinux 9.
Conclusion
At this point, you have learned to Install and Configure NTP Server and Client on AlmaLinux 9. Setting up NTP on your server ensures accurate and synchronized time across all systems in a network. Time synchronization is crucial for logging, security (e.g., Kerberos), database consistency, and coordination of scheduled tasks.
Hope you enjoy it. You may also like to read the following articles:
Disable NTP Network Time Synchronization on Ubuntu
Update Timezone DB in Linux (tz or zoneinfo)
Set Up Time Synchronization on Debian 12 Bookworm
Alternative Solutions for Time Synchronization on AlmaLinux 9
While Chrony is a powerful and efficient NTP implementation, alternative solutions exist for achieving time synchronization on AlmaLinux 9. Here are two different approaches:
1. Using systemd-timesyncd
systemd-timesyncd
is a simpler, lightweight alternative to Chrony, integrated directly into the systemd
system and service manager. It’s suitable for most general-purpose systems that only need basic time synchronization and don’t require the advanced features of Chrony, such as handling intermittent network connectivity or serving time to other clients.
Explanation:
systemd-timesyncd
operates by periodically querying NTP servers and gradually adjusting the system clock to match the correct time. It’s designed to be less resource-intensive than Chrony, making it a good choice for systems with limited resources or where precise timekeeping is not critical. It automatically starts on boot and keeps the system clock synchronized.
Configuration:
Configuration for systemd-timesyncd
is minimal. The primary configuration file is /etc/systemd/timesyncd.conf
.
-
Check if
systemd-timesyncd
is enabled:systemctl is-enabled systemd-timesyncd
If it’s not enabled, enable it:
sudo systemctl enable systemd-timesyncd
-
Start/Restart the service:
sudo systemctl restart systemd-timesyncd
-
Verify the status:
systemctl status systemd-timesyncd
-
(Optional) Configure NTP Servers:
Edit
/etc/systemd/timesyncd.conf
to specify NTP servers if you don’t want to use the default ones.[Time] NTP=0.us.pool.ntp.org 1.us.pool.ntp.org 2.us.pool.ntp.org FallbackNTP=time.google.com
After editing, restart the service.
When to Use:
- Simple desktop or laptop systems where basic time synchronization is sufficient.
- Virtual machines that rely on the hypervisor for time synchronization.
- Systems with limited resources.
2. Using Precision Time Protocol (PTP)
For environments demanding extremely high accuracy (sub-microsecond level), the Precision Time Protocol (PTP), defined by IEEE 1588, is a more suitable alternative. This is especially relevant in industries like telecommunications, finance, and industrial automation. Unlike NTP, which relies on software timestamps and network latency estimation, PTP utilizes hardware timestamps and dedicated hardware to minimize latency and achieve much greater precision.
Explanation:
PTP operates on a master-slave architecture where a "grandmaster clock" provides the reference time to other devices on the network. PTP devices exchange timing messages, including synchronization, delay request, and delay response messages. Hardware timestamping, where the time of sending and receiving packets is recorded directly by the network interface card (NIC), eliminates the variability introduced by the operating system and network stack.
Implementation (using ptp4l
– PTP for Linux):
-
Install
ptp4l
and related tools:sudo dnf install ptp4l
-
Configure
ptp4l
:Create a configuration file, for example,
/etc/ptp4l.conf
, and specify the network interface to use.[global] interface=eth0 # Replace with your network interface
-
Run
ptp4l
:sudo ptp4l -f /etc/ptp4l.conf -i eth0
-
Synchronize the system clock using
phc2sys
:phc2sys
synchronizes the system clock with the PTP hardware clock.sudo phc2sys -s eth0 -c CLOCK_REALTIME -w
The
-s
option specifies the PTP hardware clock interface,-c
specifies the system clock, and-w
causesphc2sys
to wait until the clocks are synchronized. -
Automate the process (using systemd):
Create systemd service files for
ptp4l
andphc2sys
to start them automatically at boot.
When to Use:
- High-frequency trading platforms.
- Telecommunication networks requiring precise synchronization for cellular base stations.
- Industrial control systems needing coordinated actions based on precise time.
- Scientific experiments requiring synchronized data acquisition.
These alternative solutions provide different levels of accuracy and complexity compared to the Chrony-based NTP setup. The choice depends on the specific requirements of your environment and the level of time synchronization needed. Setting up NTP Server and Client on AlmaLinux 9 can be effectively done using either of these methods, given that you select the best setup for your needs.