Subscribe to our RSS feed to get alerted every time SUBSCRIBE!

How to Sync Time with Timezone on AlmaLinux / Rocky Linux

Time synchronization is the most vital part of on Enterprise Linux. The configuration of time sync is straight forward using NTP (Network Time Protocol). It includes some couple of commands that works fine with the time synchronization. Keeping different clocks running into a same severs is a quite interesting task to keep running your system time up to date.

When any user login to your system so it is so important task to note the user login time according to the local time of that system time zone. Most of the services are running in different time zones so it is vital need to run the system with accurate time.

Step-1 : Check the different available time zones and Set your Time Zone from different timezone

List the timezone that are available

 sudo timedatectl list-timezones

Set your location timezone

 sudo timedatectl Asia/Kolkata

Step-2 : Sync time using NTP daemons

There are two types of NTP daemons including chronyd and ntpd. You should select and use only one to avoid running two NTP daemons at a same time on same machine this cause ntp incompatibility and instability using two NTP daemons at same time.

This tutorial includes two NTP daemons you should select any one:

  1. Sync time using chronyd and it is suitable for virtual system.
  2. Sync time using ntpd and it is suitable for networking system.

Step-3 : Sync time using chronyd

Install the chronyd package

 sudo yum install chrony

Start the chronyd services

 sudo systemctl start chrnoyd

Edit the configuration file

 sudo vi /etc/chrony.conf

Add these lines

1st Option

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

2nd Option

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

After adding these lines simply save and exit.

Restart the services to make changes in effect.

 sudo systemctl restart chrnoyd

Enable this services to run at every boot.

 sudo systemctl enable chrnoyd

Step-4 : Sync time using ntpd

Install the ntpd package

 sudo yum install ntp

Start the ntpd services

 sudo systemctl start ntpd

Edit the configuration file

 sudo vi /etc/ntp.conf

Add these lines

1st Options

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

2nd Options

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

After adding these lines simply save and exit.

Restart the services to make changes in effect.

 sudo systemctl restart ntpd

Enable this services to run at every boot.

 sudo systemctl enable ntpd

Congratulations now you have configured sync time with timezone on Enterprise Linux.