How To Install NTP Server on CentOS 8

Install NTP Server on CentOS 8

In this tutorial, we will show you how to install NTP Server on CentOS 8. For those of you who didn’t know, Chrony is an implementation of the Network Time Protocol (NTP). Chrony commonly synchronizes a computer to Internet time servers or other sources, such as a radio or satellite receiver or telephone modem service. It can also be used as a time source/server for client systems.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the NTP Server on a CentOS 8.

Install NTP Server on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date.

sudo dnf update
sudo dnf install epel-release

Step 2. Installing NTP Server on CentOS 8.

Run the following command to install Chrony:

sudo dnf install chrony

Step 3. Configure Chrony NTP server.

We will configure the servers as an NTP server, which will act as a remote time server for all clients in your organization:

nano /etc/chrony.conf

Add the following line:

# line 3: change servers to synchronize (replace to your own timezone NTP server)
# need NTP server itself to sync time with other NTP server
# pool 2.centos.pool.ntp.org iburst
pool ntp.nict.jp iburst
# line 24: add network range to allow to receive time synchronization requests from NTP Clients
# specify your local network and so on
# if not specified, only localhost is allowed
allow 10.0.0.0/24

Restart the Chrony service to apply the configuration change:

sudo systemctl restart chronyd
sudo systemctl enable chronyd

Step 4. Configure Firewall.

Add the firewall rules to allow NTP requests from clients:

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

Step 5. Verify NTP server.

We will now check if NTP is working by entering the following command:

[[email protected] ~]# chronyc sources
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^+ ntp-a3.nict.go.jp             1   8   466   331   +937us[ +937us] +/- 8281us
^* ntp-k1.nict.jp                1   8   466   318  -1925us[-2056us] +/- 8056us
^+ ntp-b2.nict.go.jp             1   7   466   286   -180ns[ -180ns] +/-   10ms
^+ ntp-b3.nict.go.jp             1   6   466    22   +478us[ +478us] +/- 9808us

Congratulations! You have successfully installed NTP. Thanks for using this tutorial for installing the NTP Server on your CentOS 8 system. For additional help or useful information, we recommend you to check the official Chrony website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!