Network Time Protocol (NTP) automatically syncs your system’s time with a remote server. With the NTP server, you can keep your system time up to date as per the main server. Your system clock time may drift slightly from the time you have set on the clock, but the up-to-date time on the system helps you to find the logs from the time and date you want to check.

The following are the steps to install and configure NTP Server on on Modern Linux OS.

Step 1: Install NTP or Chrony

For RHEL-based distros (AlmaLinux, Rocky, CentOS, RHEL):
# sudo dnf install chrony -y
For Ubuntu/Debian-based distros:
# sudo apt update
# sudo apt install chrony -y

Step 2: Once the installation is complete, you can run this command to run the service on boot time:

# sudo systemctl enable chronyd

Step 3: You can start the NTP service with the command given below:

# sudo systemctl start chronyd

Step 4: After installation of the NTP server, you can click on this link –https://www.pool.ntp.org/en/ for the NTP Public Pool time server. Then, select the continent where your server is located and find your country on the NTP server list.

Step 5: Now, edit the /etc/ntp.conf configuration file of the NTP daemon and comment on the default public server from pool.ntp.org, and change the list provided by your country.

# sudo nano /etc/chrony.conf     (RHEL-based)
# OR
# sudo nano /etc/chrony/chrony.conf   
(Ubuntu/Debian)

From

# sever 0.centos.pool.ntp.org iburst
# sever 1.centos.pool.ntp.org iburst

Change it to

sever 0.ro.pool.ntp.org iburst
sever 1.ro.pool.ntp.org iburst

Step 6: If you want to allow customers from your networks to sync time with this server, then make changes in the NTP configuration, such as given below:

# allow 192.168.1.0/24

Step 7: As per the nomodify notrap, your clients don’t have permission to configure the server. However, you can add a rule in the firewall if it is enabled on your server.

# sudo firewall-cmd –add-service=ntp –permanent
For UFW (Ubuntu/Debian):
# sudo ufw allow ntp

Step 8: Reload the firewall.

# sudo firewall-cmd --reload

Step 9: Enable the NTP server

# sudo systemctl restart chronyd

Step 10: Check the NTP status to ensure it is running fine.

# sudo systemctl status chronyd

Step 11: You can verify the time sync by executing the command below:

# chronyc tracking
# chronyc sources

# date –R
# timedatectl status
Was this answer helpful? 1 Users Found This Useful (1 Votes)