source: networking/netprogs/ntp.xml@ 45ab6c7

11.0 11.1 11.2 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 upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 45ab6c7 was 45ab6c7, checked in by Xi Ruoyao <xry111@…>, 3 years ago

more SVN prop clean up

Remove "$LastChanged$" everywhere, and also some unused $Date$

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