CentOSLinuxTutorials

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.

Prerequisites

  • A server running one of the following operating systems: CentOS 8.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

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:

[root@idroot.us ~]# 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!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button