Wednesday, 4 November 2020

How to Set Correct Time in CentOS 7 using ntpdate



The ntpdate utility can be used to synch the correct time from a NTP Server or any public NTP Server. Correct time and time zone can help to manage system tasks, user tasks and most of the operations on a Linux System. Ntpdate package is available in CentOS 7 base repository. 
 
This article describes, How to Set Correct Time in CentOS 7 using ntpdate.
 
Step 1: NTPDATE Package installation: Run the following command to install ntpdate package: 
 
[root@linuxcnf ~]# yum install ntpdate -y
Loaded plugins: fastestmirror
…………………………….
Installed:
  ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2
 
Complete!
[root@linuxcnf ~]#
 
Step 2. Time Synching: Run the following commands to check the current time and sync the correct time from a public NTP server:
 
[root@linuxcnf ~]# date
Fri Sep 25 18:57:17 IST 2020
[root@linuxcnf ~]#
 
[root@linuxcnf ~]# ntpdate -u 0.centos.pool.ntp.org
 4 Nov 18:59:16 ntpdate[6928]: step time server 139.59.55.93 offset 3455889.194531 sec
[root@linuxcnf ~]#
 
Step 3. Validation: Run the following command to validate the correct time:
 
[root@linuxcnf ~]# date
Wed Nov  4 18:59:22 IST 2020
[root@linuxcnf ~]#

Done! Now the correct time is set on the system.

No comments:

Post a comment