Skip to Content
| GAGE


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:

ntp-4.2.4p2-1.fc6

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 255.255.255.0 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 132.163.4.101 2 u 192 1024 377 .659 -0.517 3.265
+time-b.timefreq.bldrdoc.gov 132.163.4.102 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.

 

Last modified: 2019-12-27  16:36:35  America/Denver