Cantech Knowledge Base

Your Go-To Hosting Resource

How to Set the Timezone and Configure NTP on Rocky Linux?

Introduction

Correct time settings are vital for smooth server operations, from keeping logs accurate to ensuring scheduled tasks run on time. On Rocky Linux, configuring the right timezone and using NTP set timezone helps your system stay synchronized with trusted global time servers.

This guide will walk you through the simple but crucial steps to set the timezone and configure NTP (Network Time Protocol) on Rocky Liltrnux. Whether you are preparing a brand-new server or tightening up an existing deployment, these configurations will ensure your system stays aligned with the world’s clocks and avoids the hidden pitfalls of time drift.

Prerequisites

  • Before you start, make sure you:
  • Have a Rocky Linux server (local or cloud-based)
  • Can connect to it via SSH.
  • Are logged in as a user with sudo privileges.
  • Have you updated your system?

Current TimeZone

Start by checking your current timezone and synchronization status:

timedatectl

Output:

 Local time: Sat 2022-04-02 00:44:18 UTC
           Universal time: Sat 2022-04-02 00:44:18 UTC
                 RTC time: Sat 2022-04-02 00:44:17
                Time zone: UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

By default, Rocky Linux uses UTC. This is great for consistency across distributed systems, but you might want to change it to your local time for easier troubleshooting or regional operations.

Set Timezone

To see the list of available timezones:

timedatectl list-timezones

Use the arrow keys to navigate, or type / to search. When you find your desired timezone, take note of the exact name (including capitalization). Press q to exit.

Let’s set it to the South Pole (just for fun):

sudo timedatectl set-timezone Antarctica/North_Pole

Verify the timezone.

cat /etc/timezone

You should see:

Antarctica/North_Pole

Check the current date and time again:

date

Output:

Sat 02 Apr 2022 04:22:00 AM NZST

Want to switch back to UTC later? Just run:

sudo timedatectl set-timezone Etc/UTC

Synchronize your system time using NTP

Rocky Linux uses systemd-timesyncd or Chrony to sync with NTP servers. First, let’s verify that it’s working:

timedatectl status

Output:

Local time: Sat 2022-04-09 04:23:00 NZST
           Universal time: Fri 2022-04-08 16:23:00 UTC
                 RTC time: Fri 2022-04-08 16:23:00
                Time zone: Antarctica/North_Pole (NZST, +1200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

If the service isn’t active, turn it on:

sudo timedatectl set-ntp on

Give it a moment, then re-run below command to confirm.

timedatectl status

Detailed NTP Configuration

Rocky Linux uses Chrony for time synchronization. Let’s check which NTP servers are configured.

cat /etc/chrony.conf

You can view the default NTP servers:

server 1.time.constant.com iburst
server 2.time.constant.com iburst
server 3.time.constant.com iburst

To change these to public NTP servers, edit the configuration:

sudo nano /etc/chrony.conf

Replace the server lines with your preferred ones. For example, if you’re in the India:

server 0.IN.pool.ntp.org iburst
server 1.IN.pool.ntp.org iburst
server 2.IN.pool.ntp.org iburst
server 3.IN.pool.ntp.org iburst

Save and exit, then restart Chrony:

sudo systemctl restart chronyd

Check the current NTP sources:

chronyc sources

And confirm synchronization status:

chronyc tracking

Output:

Reference ID    : C3A8D0D2 (0.uk.pool.ntp.org)
Stratum         : 2
Ref time (UTC)  : Fri Apr 08 00:18:17 2022
System time     : 0.000303299 seconds fast of NTP time
Last offset     : +0.000142631 seconds
RMS offset      : 0.000152918 seconds
Frequency       : 6.807 ppm slow

Optional: Setup NTP Server

If you want to provide time sync to other systems (e.g., in a private network), you can turn your server into an NTP server.

Step 1: Allow Requests

Edit the main Chrony config:

sudo nano /etc/chrony.conf

Add this line to allow clients from a private subnet:

allow 10.0.0.0/24

To allow any host (not recommended in production):

allow 0.0.0.0/0

Restart Chrony:

sudo systemctl restart chronyd

Step 2: Open the NTP Port

Allow NTP through the firewall:

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

Restart the Firewall.

sudo firewall-cmd --reload

Configure Clients to Use Your NTP Server.

On every client that will synchronize with your NTP server:

  • Edit the Chrony config:
sudo nano /etc/chrony.conf
  • Add your NTP server’s IP address:
server 10.0.0.1 iburst
  • Restart Chrony:
sudo systemctl restart chronyd
  • Check if the client is syncing:
chronyc sources
  • Check the status of NTP synchronization.
chronyc tracking

Output:

Reference ID    : 4723FC8B (10.0.0.1.cantechuser.com)
Stratum         : 3
Ref time (UTC)  : Fri Sep 20 10:15:12 2024
System time     : 0.000000123 seconds fast of NTP time
Last offset     : -0.000012345 seconds
RMS offset      : 0.000045678 seconds
Frequency       : 15.123 ppm slow
Residual freq   : +0.123 ppm
Skew            : 0.045 ppm
Root delay      : 0.023456789 seconds
Root dispersion : 0.056789012 seconds
Update interval : 64.0 seconds
Leap status     : Normal
  • On your server, check which clients are connected:
chronyc clients

Output:

Hostname                      NTP   Drop Int IntL Last     Cmd   Drop Int  Last
===============================================================================
10.0.0.1                      2      0   6   -     8       0      0   -     -

Conclusion

Configuring the correct timezone and setting up reliable NTP synchronization may seem like a small detail, but it forms the backbone of a well-managed Rocky Linux system. From debugging issues to keeping secure transactions properly timestamped, accurate timekeeping influences nearly every aspect of server operation.

By following these steps, you’ve not only aligned your linux server with the correct timezone but also ensured it remains consistently accurate, no matter where it’s deployed. With time on your side, your Rocky Linux system is better equipped to handle the demands of modern computing reliably, securely, and precisely.

For more details, Learn how to set the timezone and configure NTP on Windows Server.

September 29, 2025