Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have CentOS machine and each time I've noticed that the server loses correct time after a while. It is usually behind by several minutes after time passes from having manually set the correct time. Is there a mechanism whereby I can update the server with the time from a specific time server?

share|improve this question
up vote 52 down vote accepted

Use the ntp daemon. Run yum install ntp and ensure that the service is started via ntsysv or chkconfig ntpd on.

To get an immediate sync, run ntpdate (or something similar).

share|improve this answer
@ewhite I did yum and it is show ing is also already install. so what should be my next step? How to config my time to point to the ntp server? – user111196 Mar 12 '12 at 5:22
Try /sbin/service ntpd stop, followed by ntpdate and then /sbin/service ntpd start – ewwhite Mar 12 '12 at 5:36
@ewwhite Another solution is to run ntpdate -b -u which will attempt to use a separate port than the ntpd daemon is using. – Shard Jan 7 '15 at 5:58
For me ntpdate worked without specifying a timeserver. – SPRBRN Mar 17 '15 at 12:38

You need to install and configure ntp.

yum install ntp
chkconfig ntpd on
service ntpd start

should get things set up and running. You may find that the ntp package is already installed and just needs configuring.

share|improve this answer
If the computer being changed is not a VM, then I hwclock -w after the ntpdate command. This means the next time the computer reboots, your clock will be less out-of-sync than it is now. – David Mackintosh Mar 12 '12 at 3:45
@lain I already check is install but what to config to point to the ntp server and keep it remain syn? – user111196 Mar 12 '12 at 5:23
@user111196: JUst perform the chkconfig, ntpdate and service commands above. – Iain Mar 12 '12 at 7:12
@lain what I am interest to learn on which time will it syn to is it my current time zone is it? – user111196 Mar 12 '12 at 15:59
Yes, the time will be correct for the time zone that your system is set to. – Iain Mar 12 '12 at 17:49



yum install ntp
chkconfig ntpd on

Do an initial sync, with


and start the time daemon with:

/etc/init.d/ntpd start
share|improve this answer
how to do the initial sync any command? You mean just run ntpdate but where is the time set? – user111196 Mar 12 '12 at 5:24
ntpdate sets the time. – Tom O'Connor Mar 12 '12 at 13:19
ntpdate set the date according to the server's time zone settings rite – user111196 Mar 14 '12 at 2:00
ntpdate sets the hardware clock. Whatever you're doing with /etc/timezone is a bit more userspacey. – Tom O'Connor Mar 14 '12 at 9:48

You'll need to configure ntpd for the server. I suspect it is already installed but needs to be configured. Note: if it is a virtual server, you probably have the option of syncing with the virtual host.

share|improve this answer


Ntpd does exactly what you're looking for - synchronizes your system clock with one or more known-good time servers.

share|improve this answer

Yea I'd use NTP, install ntp with yum and turn it on.

yum install ntp
chkconfig ntpd on

Then sync it to any ntp server of your liking with the ntpdate command

share|improve this answer

Basically there are two ways. NTP daemon and the ntpdate command. The most important difference is that ntpdate will synchronize the time at once even though it means that the system time will change. On the other hand NTP daemon will take care of the time synchronization and it will adjust the time by small steps - you can think about it like slowing down/speeding up the time of the computer to synchronize it to the correct time. Thats why people suggest to do the initial synchronization by ntpdate and then leave it to ntp daemon.

share|improve this answer

Also if using CPanel like I was and had this issue. I think using rdate. Changing to ntpd as per above fixes all issues with email, especially dovecot,etc.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.