1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY ntp-download-http "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-&ntp-version;.tar.gz">
|
---|
8 | <!ENTITY ntp-download-ftp " ">
|
---|
9 | <!ENTITY ntp-md5sum "1522d66574bae14abb2622746dad2bdc">
|
---|
10 | <!ENTITY ntp-size "6.9 MB">
|
---|
11 | <!ENTITY ntp-buildsize "114 MB (with tests)">
|
---|
12 | <!ENTITY ntp-time "0.8 SBU (with tests)">
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <sect1 id="ntp" xreflabel="ntp-&ntp-version;">
|
---|
16 | <?dbhtml filename="ntp.html"?>
|
---|
17 |
|
---|
18 | <sect1info>
|
---|
19 | <othername>$LastChangedBy$</othername>
|
---|
20 | <date>$Date$</date>
|
---|
21 | </sect1info>
|
---|
22 |
|
---|
23 | <title>ntp-&ntp-version;</title>
|
---|
24 |
|
---|
25 | <indexterm zone="ntp">
|
---|
26 | <primary sortas="a-ntp">ntp</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <sect2 role="package">
|
---|
30 | <title>Introduction to ntp</title>
|
---|
31 |
|
---|
32 | <para>The <application>ntp</application> package contains a
|
---|
33 | client and server to keep the time synchronized between various computers over
|
---|
34 | a network. This package is the official reference implementation of the
|
---|
35 | NTP protocol.</para>
|
---|
36 |
|
---|
37 | &lfs83_checked;
|
---|
38 |
|
---|
39 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
40 | <itemizedlist spacing="compact">
|
---|
41 | <listitem>
|
---|
42 | <para>Download (HTTP): <ulink url="&ntp-download-http;"/></para>
|
---|
43 | </listitem>
|
---|
44 | <listitem>
|
---|
45 | <para>Download (FTP): <ulink url="&ntp-download-ftp;"/></para>
|
---|
46 | </listitem>
|
---|
47 | <listitem>
|
---|
48 | <para>Download MD5 sum: &ntp-md5sum;</para>
|
---|
49 | </listitem>
|
---|
50 | <listitem>
|
---|
51 | <para>Download size: &ntp-size;</para>
|
---|
52 | </listitem>
|
---|
53 | <listitem>
|
---|
54 | <para>Estimated disk space required: &ntp-buildsize;</para>
|
---|
55 | </listitem>
|
---|
56 | <listitem>
|
---|
57 | <para>Estimated build time: &ntp-time;</para>
|
---|
58 | </listitem>
|
---|
59 | </itemizedlist>
|
---|
60 |
|
---|
61 | <bridgehead renderas="sect3">ntp Dependencies</bridgehead>
|
---|
62 |
|
---|
63 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
64 | <para role="required">
|
---|
65 | <xref linkend="perl-lwp-protocol-https"/>
|
---|
66 | <!--
|
---|
67 | Get all the perl modules with one internal reference.
|
---|
68 |
|
---|
69 | <ulink url="http://search.cpan.org/~behroozi/IO-Socket-SSL/">IO::Socket::SSL</ulink>,
|
---|
70 | <ulink url="http://search.cpan.org/dist/Net-SSLeay/">Net::SSLeay</ulink>,
|
---|
71 | <ulink url="http://search.cpan.org/dist/Mozilla-CA/">Mozilla::CA</ulink>
|
---|
72 | -->
|
---|
73 | </para>
|
---|
74 |
|
---|
75 | <!-- Tested 4.2.8p11 with neither wget nor lynx on system: Not required.
|
---|
76 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
77 | <para role="recommended">
|
---|
78 | <xref role="runtime" linkend="wget"/> (runtime, for
|
---|
79 | <command>update-leap</command>)
|
---|
80 | <!- - The download code for update-leap uses the File::Fetch perl module,
|
---|
81 | which may use wget, or lynx, or some core perl modules, so maybe move
|
---|
82 | to optional - ->
|
---|
83 | </para>
|
---|
84 | -->
|
---|
85 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
86 | <para role="optional">
|
---|
87 | <xref linkend="libcap-pam"/>,
|
---|
88 | <xref linkend="libevent"/>,
|
---|
89 | <ulink url="http://www.thrysoee.dk/editline/">libedit</ulink>, and
|
---|
90 | <ulink url="https://www.gnu.org/software/autogen/">libopts from AutoGen</ulink>
|
---|
91 | </para>
|
---|
92 |
|
---|
93 | <para condition="html" role="usernotes">User Notes:
|
---|
94 | <ulink url="&blfs-wiki;/ntp"/></para>
|
---|
95 |
|
---|
96 | </sect2>
|
---|
97 |
|
---|
98 | <sect2 role="installation">
|
---|
99 | <title>Installation of ntp</title>
|
---|
100 |
|
---|
101 | <para>
|
---|
102 | There should be a dedicated user and group to take control
|
---|
103 | of the <command>ntpd</command> daemon after it is
|
---|
104 | started. Issue the following commands as the
|
---|
105 | <systemitem class="username">root</systemitem> user:
|
---|
106 | </para>
|
---|
107 |
|
---|
108 | <screen role="root"><userinput>groupadd -g 87 ntp &&
|
---|
109 | useradd -c "Network Time Protocol" -d /var/lib/ntp -u 87 \
|
---|
110 | -g ntp -s /bin/false ntp</userinput></screen>
|
---|
111 |
|
---|
112 | <!-- At least one of the issues has been reported upstream. The next para
|
---|
113 | is valid for 4.8.2p10 -->
|
---|
114 | <para>
|
---|
115 | The <command>update-leap</command> command needs to be fixed in order
|
---|
116 | to run properly:
|
---|
117 | </para>
|
---|
118 |
|
---|
119 | <screen><userinput>sed -e 's/"(\\S+)"/"?([^\\s"]+)"?/' \
|
---|
120 | -i scripts/update-leap/update-leap.in</userinput></screen>
|
---|
121 |
|
---|
122 | <para>
|
---|
123 | Install <application>ntp</application> by running
|
---|
124 | the following commands:
|
---|
125 | </para>
|
---|
126 |
|
---|
127 | <screen><userinput>./configure CFLAGS="-O2 -g -fPIC" \
|
---|
128 | --prefix=/usr \
|
---|
129 | --bindir=/usr/sbin \
|
---|
130 | --sysconfdir=/etc \
|
---|
131 | --enable-linuxcaps \
|
---|
132 | --with-lineeditlibs=readline \
|
---|
133 | --docdir=/usr/share/doc/ntp-&ntp-version; &&
|
---|
134 | make</userinput></screen>
|
---|
135 |
|
---|
136 | <para>
|
---|
137 | To test the results, issue: <command>make check</command>.
|
---|
138 | </para>
|
---|
139 |
|
---|
140 | <para>
|
---|
141 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
142 | </para>
|
---|
143 |
|
---|
144 | <screen role="root"><userinput>make install &&
|
---|
145 | install -v -o ntp -g ntp -d /var/lib/ntp</userinput></screen>
|
---|
146 |
|
---|
147 | </sect2>
|
---|
148 |
|
---|
149 | <sect2 role="commands">
|
---|
150 | <title>Command Explanations</title>
|
---|
151 |
|
---|
152 | <para><envar>CFLAGS="-O2 -g -fPIC"</envar>: This environment variable
|
---|
153 | is necessary to generate Position Independent Code needed for
|
---|
154 | use in the package libraries.</para>
|
---|
155 |
|
---|
156 | <para><parameter>--bindir=/usr/sbin</parameter>: This parameter places
|
---|
157 | the administrative programs in <filename
|
---|
158 | class="directory">/usr/sbin</filename>.</para>
|
---|
159 |
|
---|
160 | <para><parameter>--enable-linuxcaps</parameter>: ntpd is run as user
|
---|
161 | ntp, so use Linux capabilities for non-root clock control.</para>
|
---|
162 |
|
---|
163 | <para><parameter>--with-lineeditlibs=readline</parameter>: This switch
|
---|
164 | enables <application>Readline</application> support for
|
---|
165 | <command>ntpdc</command> and <command>ntpq</command> programs. If omitted,
|
---|
166 | <application>libedit</application> will be used if installed, otherwise no
|
---|
167 | readline capabilites will be compiled.</para>
|
---|
168 |
|
---|
169 | </sect2>
|
---|
170 |
|
---|
171 | <sect2 role="configuration">
|
---|
172 | <title>Configuring ntp</title>
|
---|
173 |
|
---|
174 | <sect3 id="ntp-config">
|
---|
175 | <title>Config Files</title>
|
---|
176 |
|
---|
177 | <para><filename>/etc/ntp.conf</filename></para>
|
---|
178 |
|
---|
179 | <indexterm zone="ntp ntp-config">
|
---|
180 | <primary sortas="e-etc-ntp.conf">/etc/ntp.conf</primary>
|
---|
181 | </indexterm>
|
---|
182 |
|
---|
183 | </sect3>
|
---|
184 |
|
---|
185 | <sect3>
|
---|
186 | <title>Configuration Information</title>
|
---|
187 |
|
---|
188 | <para>The following configuration file first defines various ntp
|
---|
189 | servers with open access from different continents. Second, it
|
---|
190 | creates a drift file where <command>ntpd</command> stores the
|
---|
191 | frequency offset and a pid file to store the
|
---|
192 | <command>ntpd</command> process ID. Third, it defines the location
|
---|
193 | for the leap-second definition file
|
---|
194 | <filename>/etc/ntp.leapseconds</filename>, that the
|
---|
195 | <command>update-leap</command> script checks and updates, when
|
---|
196 | necessary. This script can be run as a cron job and the
|
---|
197 | <application>ntp</application> developers recommend a frequency of
|
---|
198 | about three weeks for the updates. Since the documentation included
|
---|
199 | with the package is sparse, visit the ntp website at
|
---|
200 | <ulink url="http://www.ntp.org/"/> and
|
---|
201 | <ulink url="http://www.pool.ntp.org/"/> for more information.</para>
|
---|
202 |
|
---|
203 | <screen role="root"><userinput>cat > /etc/ntp.conf << "EOF"
|
---|
204 | <literal># Asia
|
---|
205 | server 0.asia.pool.ntp.org
|
---|
206 |
|
---|
207 | # Australia
|
---|
208 | server 0.oceania.pool.ntp.org
|
---|
209 |
|
---|
210 | # Europe
|
---|
211 | server 0.europe.pool.ntp.org
|
---|
212 |
|
---|
213 | # North America
|
---|
214 | server 0.north-america.pool.ntp.org
|
---|
215 |
|
---|
216 | # South America
|
---|
217 | server 2.south-america.pool.ntp.org
|
---|
218 |
|
---|
219 | driftfile /var/lib/ntp/ntp.drift
|
---|
220 | pidfile /var/run/ntpd.pid
|
---|
221 |
|
---|
222 | leapfile /etc/ntp.leapseconds</literal>
|
---|
223 | EOF</userinput></screen>
|
---|
224 |
|
---|
225 | <para>
|
---|
226 | You may wish to add a <quote>Security session</quote>. For
|
---|
227 | explanations, see
|
---|
228 | <ulink url="https://www.eecis.udel.edu/~mills/ntp/html/accopt.html#restrict"/>.
|
---|
229 | </para>
|
---|
230 |
|
---|
231 | <screen role="root"><userinput>cat >> /etc/ntp.conf << "EOF"
|
---|
232 | <literal># Security session
|
---|
233 | restrict default limited kod nomodify notrap nopeer noquery
|
---|
234 | restrict -6 default limited kod nomodify notrap nopeer noquery
|
---|
235 |
|
---|
236 | restrict 127.0.0.1
|
---|
237 | restrict ::1</literal>
|
---|
238 | EOF</userinput></screen>
|
---|
239 |
|
---|
240 | </sect3>
|
---|
241 |
|
---|
242 | <sect3 id="ntp-init">
|
---|
243 | <title>Synchronizing the Time</title>
|
---|
244 |
|
---|
245 | <para>There are two options. Option one is to run <command>ntpd</command>
|
---|
246 | continuously and allow it to synchronize the time in a gradual manner. The
|
---|
247 | other option is to run <command>ntpd</command> periodically (using cron)
|
---|
248 | and update the time each time <command>ntpd</command> is scheduled.</para>
|
---|
249 |
|
---|
250 | <para>If you choose Option one, then install the
|
---|
251 | <phrase revision="sysv"><filename>/etc/rc.d/init.d/ntp</filename>
|
---|
252 | init script</phrase>
|
---|
253 | <phrase revision="systemd"><filename>ntpd.service</filename> unit</phrase>
|
---|
254 | included in the
|
---|
255 | <xref linkend="bootscripts" revision="sysv"/>
|
---|
256 | <xref linkend="systemd-units" revision="systemd"/> package.</para>
|
---|
257 |
|
---|
258 | <indexterm zone="ntp ntp-init" revision="sysv">
|
---|
259 | <primary sortas="f-ntp">ntp</primary>
|
---|
260 | </indexterm>
|
---|
261 |
|
---|
262 | <indexterm zone="ntp ntp-init" revision="systemd">
|
---|
263 | <primary sortas="f-ntpd">ntpd.service</primary>
|
---|
264 | </indexterm>
|
---|
265 |
|
---|
266 | <screen role="root"><userinput>make install-ntpd</userinput></screen>
|
---|
267 |
|
---|
268 | <para>If you prefer to run <command>ntpd</command> periodically, add the
|
---|
269 | following command to <systemitem class="username">root</systemitem>'s
|
---|
270 | <filename>crontab</filename>:</para>
|
---|
271 |
|
---|
272 | <screen><literal>ntpd -q</literal></screen>
|
---|
273 |
|
---|
274 | <para revision="sysv">Execute the following command if you would like to
|
---|
275 | set the hardware clock to the current system time at shutdown and
|
---|
276 | reboot:</para>
|
---|
277 |
|
---|
278 | <screen role="root" revision="sysv"><userinput>ln -v -sf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
|
---|
279 | ln -v -sf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock</userinput></screen>
|
---|
280 |
|
---|
281 | <para revision="sysv">The other way around is already set up by
|
---|
282 | LFS.</para>
|
---|
283 |
|
---|
284 | </sect3>
|
---|
285 |
|
---|
286 | </sect2>
|
---|
287 |
|
---|
288 | <sect2 role="content">
|
---|
289 | <title>Contents</title>
|
---|
290 |
|
---|
291 | <segmentedlist>
|
---|
292 | <segtitle>Installed Programs</segtitle>
|
---|
293 | <segtitle>Installed Libraries</segtitle>
|
---|
294 | <segtitle>Installed Directories</segtitle>
|
---|
295 |
|
---|
296 | <seglistitem>
|
---|
297 | <seg>calc_tickadj, ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq,
|
---|
298 | ntptime, ntptrace, sntp, tickadj and update-leap</seg>
|
---|
299 | <seg>None</seg>
|
---|
300 | <seg>/usr/share/ntp,
|
---|
301 | /usr/share/doc/ntp-4.2.8 and
|
---|
302 | /var/lib/ntp</seg>
|
---|
303 | </seglistitem>
|
---|
304 | </segmentedlist>
|
---|
305 |
|
---|
306 | <variablelist>
|
---|
307 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
308 | <?dbfo list-presentation="list"?>
|
---|
309 | <?dbhtml list-presentation="table"?>
|
---|
310 |
|
---|
311 | <varlistentry id="calc_tickadj">
|
---|
312 | <term><command>calc_tickadj</command></term>
|
---|
313 | <listitem>
|
---|
314 | <para>calculates optimal value for tick given ntp drift file.</para>
|
---|
315 | <indexterm zone="ntp calc_tickadj">
|
---|
316 | <primary sortas="b-calc_tickadj">calc_tickadj</primary>
|
---|
317 | </indexterm>
|
---|
318 | </listitem>
|
---|
319 | </varlistentry>
|
---|
320 |
|
---|
321 | <varlistentry id="ntp-keygen">
|
---|
322 | <term><command>ntp-keygen</command></term>
|
---|
323 | <listitem>
|
---|
324 | <para>generates cryptographic data files used by the NTPv4 authentication
|
---|
325 | and identification schemes.</para>
|
---|
326 | <indexterm zone="ntp ntp-keygen">
|
---|
327 | <primary sortas="b-ntp-keygen">ntp-keygen</primary>
|
---|
328 | </indexterm>
|
---|
329 | </listitem>
|
---|
330 | </varlistentry>
|
---|
331 |
|
---|
332 | <varlistentry id="ntp-wait">
|
---|
333 | <term><command>ntp-wait</command></term>
|
---|
334 | <listitem>
|
---|
335 | <para>is useful at boot time, to delay the boot sequence until
|
---|
336 | <command>ntpd</command> has set the time.</para>
|
---|
337 | <indexterm zone="ntp ntp-wait">
|
---|
338 | <primary sortas="b-ntp-wait">ntp-wait</primary>
|
---|
339 | </indexterm>
|
---|
340 | </listitem>
|
---|
341 | </varlistentry>
|
---|
342 |
|
---|
343 | <varlistentry id="ntpd">
|
---|
344 | <term><command>ntpd</command></term>
|
---|
345 | <listitem>
|
---|
346 | <para>is a ntp daemon that runs in the background and keeps
|
---|
347 | the date and time synchronized based on response from configured
|
---|
348 | ntp servers. It also functions as a ntp server.</para>
|
---|
349 | <indexterm zone="ntp ntpd">
|
---|
350 | <primary sortas="b-ntpd">ntpd</primary>
|
---|
351 | </indexterm>
|
---|
352 | </listitem>
|
---|
353 | </varlistentry>
|
---|
354 |
|
---|
355 | <varlistentry id="ntpdate">
|
---|
356 | <term><command>ntpdate</command></term>
|
---|
357 | <listitem>
|
---|
358 | <para>is a client program that sets the date and time based on
|
---|
359 | the response from an ntp server. This command is deprecated.</para>
|
---|
360 | <indexterm zone="ntp ntpdate">
|
---|
361 | <primary sortas="b-ntpdate">ntpdate</primary>
|
---|
362 | </indexterm>
|
---|
363 | </listitem>
|
---|
364 | </varlistentry>
|
---|
365 |
|
---|
366 | <varlistentry id="ntpdc">
|
---|
367 | <term><command>ntpdc</command></term>
|
---|
368 | <listitem>
|
---|
369 | <para>is used to query the ntp daemon about its current state
|
---|
370 | and to request changes in that state.</para>
|
---|
371 | <indexterm zone="ntp ntpdc">
|
---|
372 | <primary sortas="b-ntpdc">ntpdc</primary>
|
---|
373 | </indexterm>
|
---|
374 | </listitem>
|
---|
375 | </varlistentry>
|
---|
376 |
|
---|
377 | <varlistentry id="ntpq">
|
---|
378 | <term><command>ntpq</command></term>
|
---|
379 | <listitem>
|
---|
380 | <para>is a utility program used to monitor <command>ntpd</command>
|
---|
381 | operations and determine performance.</para>
|
---|
382 | <indexterm zone="ntp ntpq">
|
---|
383 | <primary sortas="b-ntpq">ntpq</primary>
|
---|
384 | </indexterm>
|
---|
385 | </listitem>
|
---|
386 | </varlistentry>
|
---|
387 |
|
---|
388 | <varlistentry id="ntptime">
|
---|
389 | <term><command>ntptime</command></term>
|
---|
390 | <listitem>
|
---|
391 | <para>reads and displays time-related kernel variables.</para>
|
---|
392 | <indexterm zone="ntp ntptime">
|
---|
393 | <primary sortas="b-ntptime">ntptime</primary>
|
---|
394 | </indexterm>
|
---|
395 | </listitem>
|
---|
396 | </varlistentry>
|
---|
397 |
|
---|
398 | <varlistentry id="ntptrace">
|
---|
399 | <term><command>ntptrace</command></term>
|
---|
400 | <listitem>
|
---|
401 | <para>traces a chain of ntp servers back to the primary source.</para>
|
---|
402 | <indexterm zone="ntp ntptrace">
|
---|
403 | <primary sortas="b-ntptrace">ntptrace</primary>
|
---|
404 | </indexterm>
|
---|
405 | </listitem>
|
---|
406 | </varlistentry>
|
---|
407 |
|
---|
408 | <varlistentry id="sntp">
|
---|
409 | <term><command>sntp</command></term>
|
---|
410 | <listitem>
|
---|
411 | <para>is a Simple Network Time Protocol (SNTP) client.</para>
|
---|
412 | <indexterm zone="ntp sntp">
|
---|
413 | <primary sortas="b-sntp">sntp</primary>
|
---|
414 | </indexterm>
|
---|
415 | </listitem>
|
---|
416 | </varlistentry>
|
---|
417 |
|
---|
418 | <varlistentry id="tickadj">
|
---|
419 | <term><command>tickadj</command></term>
|
---|
420 | <listitem>
|
---|
421 | <para>reads, and optionally modifies, several timekeeping-related
|
---|
422 | variables in older kernels that do not have support for precision
|
---|
423 | timekeeping.</para>
|
---|
424 | <indexterm zone="ntp tickadj">
|
---|
425 | <primary sortas="b-tickadj">tickadj</primary>
|
---|
426 | </indexterm>
|
---|
427 | </listitem>
|
---|
428 | </varlistentry>
|
---|
429 |
|
---|
430 | <varlistentry id="update-leap">
|
---|
431 | <term><command>update-leap</command></term>
|
---|
432 | <listitem>
|
---|
433 | <para>is a script to verify and, if necessary, update the leap-second
|
---|
434 | definition file.</para>
|
---|
435 | <indexterm zone="ntp update-leap">
|
---|
436 | <primary sortas="b-update-leap">update-leap</primary>
|
---|
437 | </indexterm>
|
---|
438 | </listitem>
|
---|
439 | </varlistentry>
|
---|
440 |
|
---|
441 | </variablelist>
|
---|
442 |
|
---|
443 | </sect2>
|
---|
444 |
|
---|
445 | </sect1>
|
---|