Knowledge Base

How to configure the time and NTP on a Linux system

Configuring the Time and NTP on a UNAVCO Linux Field Computer

Configure time and check that ntpd is running before deploying a newly-installed Fedora system to the field. Change the system time to UTC time by issuing the following command at the command line:

[root@hostname]# cp -p /usr/share/zonefino/UTC /etc/localtime

If the time is not exact, get it close to the actual time by setting the approximate current time with the following command, where M=Month, D=day, h=hour, m=minutes, Y=year, s=seconds:

[root@hostname]# date --utc MMDDhhmmYYYY.ss

Syncronize the hardware clock with the system clock by issuing:

[root@hostname]# hwclock -systohc

To maintain the computer’s timing, run the service ’ntpd’ in the background. To check if ntpd is running, run:

[root@hostname]# chkconfig --list | grep on | grep ntpd

A result of :

ntpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off

indicates that ntpd is indeed running in the background. If you don’t see this, ntpd is not running and you will either have to activate it or install it. To check if ntp is installed you can run the following command:

[root@hostname]# rpm -aq | grep ntp

A result of:


indicates that ntp is installed and the ntpd service just needs to be started. Before doing so, edit the file /etc/ntp.conf. This file specifies to ntpd which time server to syncronize with. For example, if UNAVCO’s timer sever is at xx.yy.zz.nn, enter the following to get ntpd to syncronize the new system’s time with the UNAVCO time server:

restrict xx.yy.zz.nn mask nomodify notrap server xx.yy.zz.nn

/etc/ntp.conf. Then, run the following command to make sure ntpd runs in the background and automatically syncronizes with UNAVCO’s time server:

[root@hostname]# chkconfig --level 345 ntpd on

Make sure that ntpd is syncronizing with the following command:

[root@hostname]# ntpq -c pe

This commands give you an output of the form:

remote refid st t when poll reach delay offset jitter
*time-a.timefreq.bldrdoc.gov 2 u 192 1024 377 .659 -0.517 3.265
+time-b.timefreq.bldrdoc.gov 2 u 174 1024 377 67.478 11.482t 1.770
LOCAL(0) LOCAL(0) 10 1 43 64 377 0.000 0.000t 0.004

Nonzero values for the "jitter" column is a good inication that ntpd is communicating with your time servers.

Attached Files
There are no attachments for this article.
There are no comments for this article. Be the first to post a comment.
Security Code Security Code
Related Articles RSS Feed
How to configure Fedora services on UNAVCO field computers
Viewed 1783 times since Sat, Nov 8, 2008
How to securely network a Fedora Linux system
Viewed 1679 times since Fri, Dec 12, 2008
How to configure the back-up power supply software
Viewed 6417 times since Sun, Jan 11, 2009

Last modified: Monday, 12-May-2014 00:18:29 UTC