source: networking/netprogs/ntp.xml@ 8761710

11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/xf86-video-removal
Last change on this file since 8761710 was 8761710, checked in by Xi Ruoyao <xry111@…>, 17 months ago

ntp: the test suite does not work for now

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