How to quick sync server time in AlmaLinux

sync server time in AlmaLinux, Ensuring accurate server time is crucial for the proper functioning of various services and applications. In AlmaLinux, you can easily sync your server’s time using the timedatectl command, a utility provided by systemd for querying and changing the system clock and its settings. This method leverages Network Time Protocol (NTP) to synchronize your server’s clock with global time servers.

Check Current Time and Timezone:

You can check the current system time and timezone using:

   timedatectl status

Enable Network Time Synchronization:

To ensure that network time synchronization is enabled, use the following command:

   sudo timedatectl set-ntp true

Verify NTP Synchronization:

After enabling NTP, you can verify its status with:

   timedatectl status

Look for the line NTP synchronized: yes to confirm that NTP is active.

Change Timezone (Optional):

If you need to change the server’s timezone, list available timezones:

   timedatectl list-timezones

Then set the desired timezone, for example, to set the timezone to Asia/Kolkata:

   timedatectl set-timezone Asia/Kolkata

Sync Time Immediately:

If you want to sync server time in AlmaLinux immediately after enabling NTP, you can restart the systemd-timesyncd service:

  systemctl restart systemd-timesyncd
sync server time in AlmaLinux

By following these steps, you will have sync server time in AlmaLinux using timedatectl on AlmaLinux. The timedatectl tool provides an easy way to manage time settings on systemd-based systems like AlmaLinux.