Configure ntp timeservers on centos 7Configure NTP Time Servers On CentOS 7: The purpose of this article is to help you to configure the NTP Client to synchronize with NTP Servers in CentOS 7.

Pre-requisites

This guide assumes the following conditions:

  • server with CentOS 7 installed
  • user with root-equivalent privileges

Install ntpd and ntpdate

First, You need to install the ntpd and ntpdate clients on your Linux host.

Login to the server as root user.

Run the following command as root:

yum install ntp ntpdate

If yum is not installed, then simply run the following command to install it:

rpm -Uhv https://mirrors.radwebhosting.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm

Start and Enable ntpd Service

Once that’s installed you need to start and enable the ntpd service.

systemctl start ntpd
systemctl enable ntpd
systemctl status ntpd

Configure NTP Servers

Now run the following command to configure the NTP Servers.

ntpdate -u -s 0.centos.pool.ntp.org 1.centos.pool.ntp.org 2.centos.pool.ntp.org

Command tells the ntpdate to use an unprivileged port for outgoing packets with the -u switch and to write logging output to the system syslog facility using the -s switch

Next, restart the ntpd daemon by running the following command:

systemctl restart ntpd

Check NTP Synchronization

Now check if NTP synchronization is enabled and running.

timedatectl

Set Hardware Clock

And for the last, you need to set the hardware clock to the current system time using the -w switch.

hwclock -w

You’ve now successfully set your NTP client on CentOS 7. Hope this article has helped you to sync your server with NTP Time Servers.

Avatar of editorial staff

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX and Phoenix, AZ.

Leave a Reply

lg