CentOS 7/RHEL7: How To synchronize System Time Using Ntpdate service

How to adjust the system time to a accurate time using the ntpdate command under centos7/6.5 or RHEL 7/6.5 linux? How can I synchronize system time to a accurate time? this post will show you how to use ntpdate command to adjust system time to sync with remote time ntp server.

CentOS 7 synchronize system time using ntpdate command


Firstly you need to check if ntpdate package is installed currently. issue the following command:

rpm -qa | grep ntpdate

outputs:

[root@devops /]# rpm -qa | grep ntpdate

ntpdate-4.2.6p5-18.el7.centos.x86_64

If it is not installed, running the below “yum install” command to install it,type:

yum install ntpdate

outputs:

[root@devops /]# yum install ntpdate

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

 * base: mirrors.btte.net

 * extras: mirrors.btte.net

 * updates: mirrors.yun-idc.com

Resolving Dependencies

--> Running transaction check

---> Package ntpdate.x86_64 0:4.2.6p5-19.el7.centos will be installed

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

 Package        Arch          Version                      Repository      Size

================================================================================

Installing:

 ntpdate        x86_64        4.2.6p5-19.el7.centos        updates         82 k

Transaction Summary

================================================================================

Install  1 Package

Total size: 82 k

Installed size: 121 k

Is this ok [y/d/N]: y

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:

anaconda-19.31.79-1.el7.centos.4.x86_64 has missing requires of ntpdate

ntp-4.2.6p5-18.el7.centos.x86_64 has missing requires of ntpdate = ('0', '4.2.6p5', '18.el7.centos')

  Installing : ntpdate-4.2.6p5-19.el7.centos.x86_64                         1/1 

  Verifying  : ntpdate-4.2.6p5-19.el7.centos.x86_64                         1/1 

Installed:

  ntpdate.x86_64 0:4.2.6p5-19.el7.centos                                        

Complete!

After installed ntpdate package, you now can use ntpdate command to synchronize system time from the remote ntp time server, issue the following command:

ntpdate pool.ntp.org

outputs:

[root@devops /]# ntpdate pool.ntp.org

22 Dec 04:33:10 ntpdate[3836]: adjust time server 97.107.128.58 offset -0.034519 se

You might also like:

Sidebar



back to top