How to Set the Timezone and Configure NTP on Rocky Linux

Updated on May 3, 2022
How to Set the Timezone and Configure NTP on Rocky Linux header image


Accurate time is essential for any production server and the Network Time Protocol (NTP) is the standard way to keep the system clocks synchronized to accurate sources. NTP uses the intersection algorithm to mitigate the effects of variable network latency and keep your system clock within a few milliseconds of Coordinated Universal Time (UTC). Linux systems typically keep the time in UTC, but you can also set the timezone to your local timezone. This article explains how to set the timezone on an Ubuntu Linux cloud server and use NTP to synchronize the time.


Set the Timezone

To check your current timezone, log in to your server and display the date and time.

$ timedatectl

You'll see output similar to this:

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, a Vultr Rocky Linux server uses the UTC timezone, which is usually preferable if you manage servers in different locations. However, you can set the server to your local timezone by following these steps.

  1. View a list of all timezones.

     $ timedatectl list-timezones

    Select your desired timezone and take note of the exact name and capitalization. You can use Space and B to page forward and backward or your arrow keys to move one line at a time through the list. When finished, type Q to exit the list.

    For this example, choose Antarctica/South_Pole.

  2. Set the timezone with timedatectl.

     $ sudo timedatectl set-timezone Antarctica/South_Pole

    Verify the timezone by viewing /etc/timezone.

     $ cat /etc/timezone
  3. Check the time to verify the changes.

     $ date
     Sat 02 Apr 2022 04:22:00 AM NZST

    Notice the timezone now shows NZST, indicating the time at the South Pole.

If you decide to return to UTC later, run timedatectl again with the UTC timezone.

$ sudo timedatectl set-timezone Etc/UTC

Use NTP to Synchronize the Time

Vultr's Rocky Linux systems have the timesyncd service enabled by default to synchronize their time with an NTP server. You can verify this by running timedatectl.

$ timedatectl status
               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/South_Pole (NZST, +1200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

The System clock synchronized: yes and NTP service: active lines confirm that the system clock has synchronized with an NTP server. If you see these, you can proceed to the next section. Otherwise, start the service with timedatectl. Again, you need to be the root user or use sudo.

$ sudo timedatectl set-ntp on

Wait a few minutes for the timesyncd service to start, then verify the status.

$ timedatectl status

Advanced NTP Configuration

Vultr configures new servers with NTP servers, which are low-latency servers on Vultr's network infrastructure. You can examine the configuration by viewing chrony.conf.

$ cat /etc/chrony.conf

You'll see the default NTP servers:

    server iburst
    server iburst
    server iburst

If you need to use specific NTP servers:

  1. Edit the Chrony configuration file.

     $ sudo nano /etc/chrony.conf

    Change them according to your needs. You'll find public name servers listed on the NTP support website.. For example, if you want to sync with the public UK pool, you can use the following values:

  2. Restart the Chrony NTP daemon to load changes.

     $ sudo systemctl restart chronyd
  3. Verify the new NTP pools.

     $ chronyc sources
  4. Confirm the NTP synchronization status.

     $ chronyc tracking

Optional: Setup an NTP Server

Most users do not need to set up an NTP server. However, in some situations, you may want to offer NTP service, perhaps to a Virtual Private Cloud (VPC). If you know that you need an NTP server, follow these steps.

To accept client requests to the server:

  1. Edit the main Chrony configuration file.

     $ sudo nano /etc/chrony.conf
  2. Add a line to allow requests from the desired network interface, such as a VPC network address.


    > To allow connections from all interfaces, use the Allow directive.

  3. Save and close the file.

  4. Restart Chrony to load changes.

     $ sudo systemctl restart chronyd
  5. To accept incoming client requests, allow the NTP service through the firewall.

     $ sudo firewall-cmd --permanent --add-service=ntp
  6. Restart the Firewall.

     $ sudo firewall-cmd --reload

On each client that should receive time from your NTP server:

  1. Edit the configuration file.

     $ sudo nano /etc/chrony.conf
  2. Add a line specifying your NTP time server's IP address. For example:

  3. Restart the Chrony NTP daemon to load changes.

     $ sudo systemctl restart chronyd
  4. Show available NTP sources:

     $ chronyc sources
  5. Verify the NTP synchronization status.

     $ chronyc tracking


     Reference ID    : 4622FB9A (
     Stratum         : 5
     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
     Residual freq   : +0.007 ppm
     Skew            : 0.219 ppm
     Root delay      : 0.048402909 seconds
     Root dispersion : 0.011339894 seconds
     Update interval : 64.1 seconds
     Leap status     : Normal
  6. From your NTP server, confirm the clients have connected by running the following command:

     $ chronyc clients


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


You have set up the timezone and configured NTP on Rocky Linux. For more information, please see these resources: