be on time my friends… with ntp

It’s very important to keep your system clock aligned to the exact timezone you reside. Following commands help to keep it in sync.

First select appropriate timezone
# dpkg-reconfigure tzdata

Above command actually copies your zoneinfo file from /usr/share/zoneinfo/ to /etc/localtime
So you can manually copy the file from zoneinfo directory to /etc/localtime on non-debian systems.

Now install following package to sync your system clock with Time Servers using Network Time Protocol (NTP)

# aptitude install ntpdate
# aptitude install openntpd

The ntpdate OpenNTPD keeps on checking time periodically to keep system time in sync with time servers.

OpenNTPD is a secure NTP daemon developed by OpenBSD Developers. (Theo de Raadt you r0ck ;))
You can also install ntp – a local ntp daemon as an alternative to OpenNTPD.

Thanks poisonbit for pointing out that ntpdate is now unmaintained and NTP or OpenNTPD is preferred over it. Check out first comment.

Advertisements

3 thoughts on “be on time my friends… with ntp

  1. poisonbit

    Since Debian 5 (Lenny) the usage of ntpdate is deprecated. The Debian installer uses the ‘ntp’ package (for desktops/laptops too) instead of the old ntpdate.

    The dpkg bot on IRC #debian channel say:

    
     ntpdate
     [ntpdate] a program that sets a system's clock using one of more NTP servers.  It's useful for setting the time occasionally (like on boot or connecting to internet).  Instead of using this obsolete and unmaintained program, just install the ntp package, add the 'iburst' option to the 'server' lines in ntp.conf, and make sure -g is among the NTPD_OPTS in /etc/default/ntp.  Ask me about .  See also .
    
     why not ntpdate
     Use a daemon like ntpd, chrony or openntpd instead of ntpdate to keep your time synched.  Rationale at: http://www.redhat.com/archives/nahant-list/2005-December/msg00009.html
    
    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s