Thursday, July 30, 2009

How to set the time with NTP as an option

I will show you how to manually update the time and manually use NTP to update the time.

1. Set the current time manually. Before you can use NTP, you need to have the time on your system correct to within a few minutes. If its more than an hour or so, NTP won't have confidence in the time it gets from the server and as a result, it won't update the time. As root:

date "MMDDHHmmYYYY"


where MM is the two digit month, DD is the two digit day, HH is the two digit hour on a 24-hour clock, mm is the two digit minute, and YYYY is the four digit year. For example, 6:30pm on July 30, 2009 would be:

date "073018302009"



2. As root, use YaST to setup the NTP daemon:

yast ntp-client


This YaST module is available under the "Network Services" section of the YaST2 GUI.

You'll need to set the NTP start to automatic before YaST will let add a time server. Add a public server (the tool has a pretty good list of servers you can use). Then, if you don't have a permanent Internet connection (including a laptop or a computer using the Network Manager applet), set NTP to only start manually.


3. From this point on, anytime you want to reset the time on your computer, use, as root:

ntpd -q


This will cause NTP to set the time and then quit.

No comments:

Post a Comment