CentOS Linux Install and Configure NTP to Synchronize The System Clock

CentOS Linux Install and Configure NTP to Synchronize The System Clock

To install and configure NTP (Network Time Protocol) on CentOS Linux, you will need to have root privileges or access to a user with sudo privileges.

  1. First, update the package repository by running the following command:
re‮ref‬ to:lautturi.com
sudo yum update
  1. Install the NTP package by running the following command:
sudo yum install ntp
  1. Once the installation is complete, you can start configuring NTP. The main configuration file for NTP is /etc/ntp.conf. Open this file in a text editor, such as vi or nano:
sudo vi /etc/ntp.conf
  1. In the configuration file, you can specify the NTP servers that you want to use. By default, the NTP pool servers are used, which are a group of servers that provide reliable time synchronization for anyone on the Internet. You can use the pool servers by specifying a server pool zone in the configuration file. For example, to use the pool servers for the North America region, you can add the following lines to the configuration file:
server 0.north-america.pool.ntp.org
server 1.north-america.pool.ntp.org
server 2.north-america.pool.ntp.org
server 3.north-america.pool.ntp.org
  1. Save the configuration file and exit the text editor.

  2. Start the NTP service by running the following command:

sudo systemctl start ntpd
  1. To make sure that NTP starts automatically at boot time, run the following command:
sudo systemctl enable ntpd
  1. To check the status of the NTP service, run the following command:
sudo systemctl status ntpd
  1. To check the current time synchronization status, run the following command:
ntpq -p

This will show the NTP servers that are being used and their synchronization status.

That's it! NTP should now be installed and configured on your CentOS Linux system. The system clock should now be synchronized with the NTP servers that you specified in the configuration file.

Created Time:2017-10-28 14:02:22  Author:lautturi