In this tutorial, we will show you how to install NTP Server on AlmaLinux 8. For those of you who didn’t know, NTP or Network Time Protocol is a protocol that is used to synchronize all system clocks in a network to use the same time. 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 an AlmaLinux 8.
Prerequisites
- A server running one of the following operating systems: AlmaLinux 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install NTP Server on AlmaLinux 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 AlmaLinux 8.
Now we install the required ntp package on the server:
sudo dnf install chrony
Once successfully installed, enable the chrony service to start automatically upon system boot:
sudo systemctl enable chronyd sudo systemctl start chronyd
Step 3. Configure NTP server.
Ensure the following entries are in NTP configuration file /etc/chrony.conf
:
sudo 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 192.168.1.0/24
Next, restart chrony NTP daemon to apply the changes:
sudo systemctl restart chronyd
Now, check the status of the NTP service through the following command:
chronyc sources
Step 4. Configure Firewall.
If you have firewalld enabled on AlmaLinux, you’ll need to allow the port for NTP in order to accept incoming requests:
sudo firewall-cmd --permanent --add-service=ntp sudo firewall-cmd --reload
Congratulations! You have successfully installed NTP. Thanks for using this tutorial for installing NTP Server on your AlmaLinux 8 system. For additional help or useful information, we recommend you to check the official Chrony website.