How to Install and Configure NTP (Chrony) on AlmaLinux 9

How to Install Chrony on AlmaLinux

It is the Network Time Protocol (NTP) is used to ensure that the clocks of computers are synchronized on networks. It helps ensure that all systems have an accurate time. This is crucial for authentication, logging and system operation. In this guide you will learn How to Install and Configure NTP (Chrony) on AlmaLinux 9

For AlmaLinux 9, Chrony is the default implementation of NTP services. It’s a light and more efficient alternative to the conventional NTPd daemon. It is specifically made to function efficiently in different conditions, including those with unstable connection to networks.

Table of Contents

Why Use Chrony Over Traditional NTP?

Chrony offers several advantages over the traditional ntpd service:

  • Faster Synchronization: Chrony quickly adjusts the system clock, even if there are significant differences.
  • Better Performance in Unstable Networks: It handles intermittent network connections more efficiently.
  • Supports Servers and Clients: It can be used both as an NTP client and a server.
  • Lower Resource Usage: Chrony consumes fewer system resources compared to ntpd.

For these reasons, Chrony is the recommended choice for NTP synchronization on AlmaLinux 9.

Step-by-Step Guide to Installing and Configuring Chrony on AlmaLinux 9

1. Prerequisites for Installing Chrony on AlmaLinux 9

Before proceeding with the installation, ensure you have:

  • A system running AlmaLinux 9
  • A user account with sudo privileges
  • An active internet connection

To check if Chrony is already installed, run:

bash
chronyd --version

If it returns a version number, Chrony is installed; otherwise, follow the steps below.

2. Installing Chrony on AlmaLinux 9

To install Chrony, use the dnf package manager:

bash
sudo dnf install chrony -y
install chrony almalinux

After installation, verify the installation:

bash
chronyc tracking
almalinux 9 chronyc tracking

If installed correctly, you should see details about the current NTP synchronization.

3. Configuring Chrony for NTP Synchronization

Once Chrony is installed, configure it to use the appropriate NTP servers.

1. Edit the Chrony configuration file:

bash
sudo nano /etc/chrony.conf

2. Replace the default NTP servers with ones closer to America/New_York.
Find and modify the following lines:

plaintext
pool 0.north-america.pool.ntp.org iburst
pool 1.north-america.pool.ntp.org iburst
pool 2.north-america.pool.ntp.org iburst
pool 3.north-america.pool.ntp.org iburst

Save and exit (Press CTRL+X, then Y, and Enter).

4. Setting the Timezone to America/New_York

To ensure your server operates in the correct timezone:

1. Check the current timezone:

bash
timedatectl status

2. Set the timezone to America/New_York:

bash
sudo timedatectl set-timezone America/New_York

3. Verify the change:

bash
imedatectl status

Your system should now display the correct timezone.

5. Enabling and Starting Chrony Service

After configuration, enable and start the Chrony service:

bash
sudo systemctl enable --now chronyd

To check if the service is active:

bash
systemctl status chronyd

You should see an active (running) status.

6. Verifying Time Synchronization

To confirm that your server is synchronizing correctly, use:

bash
chronyc tracking

For a detailed list of connected NTP servers:

bash
chronyc sources -v

If everything is working, you should see a list of servers and synchronization details.

Troubleshooting Common Issues

If Chrony is not working as expected, try these solutions:

1. Restart Chrony

bash
sudo systemctl restart chronyd

2. Manually sync the time

bash
sudo chronyc makestep

3. Ensure Chrony is allowed through the firewall

bash
sudo firewall-cmd --add-service=ntp --permanent sudo firewall-cmd --reload

4. Check logs for errors

bash
sudo journalctl -xeu chronyd

Conclusion and Final Thoughts

If you follow this guide You have successfully installed and set up Chrony as an NTP server/client using AlmaLinux that ensures accurate time synchronization with America/New York timezone. Chrony’s light and compact design is a great option for the latest Linux systems, offering rapid as well as reliable timing.

If you encounter any issues, feel free to revisit the troubleshooting section or check the official Chrony documentation for additional support

FAQs

1. What is the difference between Chrony and ntpd?

Chrony is a modern, faster, and more reliable alternative to ntpd. It is better suited for systems with unstable network connections and offers quicker time synchronization.

2. How do I check if my system time is synchronized?

Run:

bash
chronyc tracking

If it shows an active NTP server, your system is synchronized.

3. Can I use Chrony as an NTP server?

Yes! Modify the /etc/chrony.conf file and allow other systems to sync with your server.

4. How do I restart the Chrony service?

Use:

bash
sudo systemctl restart chronyd

5. What should I do if Chrony is not syncing time?

Ensure that:

  • The correct NTP servers are listed in /etc/chrony.conf
  • The firewall allows NTP traffic
  • The service is running and enabled

6. How do I force Chrony to update the time immediately?

If your system clock is significantly out of sync, you can force Chrony to update the time immediately by running:

bash
sudo chronyc makestep

This will correct any large discrepancies between the system time and the NTP servers.

7. How do I check which NTP servers my system is using?

To view the NTP servers your system is connected to, use:

bash
chronyc sources -v

This will display a list of configured NTP servers and their statuses.

8. Can I use Chrony to synchronize time without an internet connection?

Yes, but you need to configure Chrony as an NTP server and sync it with a hardware clock or another trusted time source within your network. You can do this by modifying /etc/chrony.conf and allowing other local clients to sync with your Chrony server.

9. How do I check the accuracy of my system’s time synchronization?

To check how well your system is synchronized, run:

bash
chronyc tracking

This will show details like the estimated error and drift rate of your system clock.

10. How do I disable Chrony if I want to use a different time synchronization method?

If you prefer to use a different NTP client, you can disable Chrony with:

bash
sudo systemctl stop chronyd
sudo systemctl disable chronyd

If you want to remove it completely:

bash
sudo dnf remove chrony -y

11. How do I allow other machines to sync with my Chrony server?

To make your Chrony instance act as an NTP server, edit /etc/chrony.conf and add:

plaintext
allow 192.168.1.0/24


Replace 192.168.1.0/24 with your actual network subnet. Restart Chrony for the changes to take effect:
bash
sudo systemctl restart chronyd

12. What should I do if my system is not syncing even after setting up Chrony?

If Chrony is not syncing, try the following steps:

  • Ensure Chrony is running
    bash
    sudo systemctl status chronyd
  • Restart the service
    bash
    sudo systemctl restart chronyd
  • Manually trigger a sync
    bash
    sudo chronyc makestep
  • Check for firewall rules blocking NTP traffic
    bash
    sudo firewall-cmd –list-services
    sudo firewall-cmd –add-service=ntp –permanent
    sudo firewall-cmd –reload
  • Verify connectivity to NTP servers bashCopyEditchronyc sources -v

13. Can I configure Chrony to use a specific NTP server instead of a pool?

Yes, instead of using a pool, you can specify a particular NTP server in /etc/chrony.conf:

plaintext
server time.nist.gov iburst

Replace time.nist.gov with your preferred NTP server.

14. Does Chrony work with virtual machines?

Yes, but VMs can have time drift issues. To reduce this, ensure:

  • Chrony is correctly configured and running.
  • Your hypervisor (VMware, KVM, VirtualBox, etc.) has proper time synchronization settings.

15. What is the difference between iburst and burst in Chrony configuration?

  • iburst: When the system boots up, it sends multiple time requests rapidly to get accurate time quickly.
  • burst: Sends multiple requests all the time, which can overload the NTP server.
    For normal configurations, iburst is recommended.

16. How do I configure Chrony to use a local clock instead of external NTP servers?

If you want Chrony to use the local hardware clock instead of syncing with external NTP servers, add this line to /etc/chrony.conf:

plaintext
server 127.127.1.0

Also, set the system clock as the preferred time source:

plaintext
local stratum 10


Restart Chrony to apply the changes:
bash
sudo systemctl restart chronyd

17. What is the stratum level in NTP, and why is it important?

The stratum level indicates how far away a system is from an authoritative time source:

  • Stratum 0 – Reference clocks (e.g., atomic clocks, GPS)
  • Stratum 1 – Directly connected NTP servers
  • Stratum 2+ – Servers synchronized from other NTP sources
    A lower stratum means a more accurate time source. Chrony adjusts its stratum dynamically based on its synchronization status.

18. Can I configure Chrony to sync time only at boot and not continuously?

Yes, modify /etc/chrony.conf and add:

plaintext
makestep 1 -1

This ensures that Chrony corrects time at startup but doesn’t adjust continuously.

19. What ports does Chrony use for NTP synchronization?

Chrony uses UDP port 123 for NTP communication. Ensure your firewall allows incoming and outgoing connections on this port.

20. How do I limit access to my Chrony NTP server to specific clients?

In /etc/chrony.conf, use the allow directive to specify which IPs or subnets can connect:

plaintext
allow 192.168.1.100
allow 192.168.1.0/24

This restricts access only to the listed IPs and subnet..