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 &&
|
---|
115 | useradd -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 | <screen><userinput>./configure --prefix=/usr \
|
---|
134 | --bindir=/usr/sbin \
|
---|
135 | --sysconfdir=/etc \
|
---|
136 | --enable-linuxcaps \
|
---|
137 | --with-lineeditlibs=readline \
|
---|
138 | --docdir=/usr/share/doc/ntp-&ntp-version; &&
|
---|
139 | make</userinput></screen>
|
---|
140 |
|
---|
141 | <para>
|
---|
142 | To test the results, issue: <command>make check</command>.
|
---|
143 | </para>
|
---|
144 |
|
---|
145 | <para>
|
---|
146 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
147 | </para>
|
---|
148 |
|
---|
149 | <screen role="root"><userinput>make install &&
|
---|
150 | install -v -o ntp -g ntp -d /var/lib/ntp</userinput></screen>
|
---|
151 |
|
---|
152 | </sect2>
|
---|
153 |
|
---|
154 | <sect2 role="commands">
|
---|
155 | <title>Command Explanations</title>
|
---|
156 |
|
---|
157 | <para>
|
---|
158 | <envar>CFLAGS="-O2 -g -fPIC"</envar>: This environment variable
|
---|
159 | is necessary to generate Position Independent Code needed for
|
---|
160 | use in the package libraries.
|
---|
161 | </para>
|
---|
162 |
|
---|
163 | <para>
|
---|
164 | <parameter>--bindir=/usr/sbin</parameter>: This parameter places
|
---|
165 | the administrative programs in <filename
|
---|
166 | class="directory">/usr/sbin</filename>.
|
---|
167 | </para>
|
---|
168 |
|
---|
169 | <para>
|
---|
170 | <parameter>--enable-linuxcaps</parameter>: ntpd is run as user
|
---|
171 | ntp, so use Linux capabilities for non-root clock control.
|
---|
172 | </para>
|
---|
173 |
|
---|
174 | <para>
|
---|
175 | <parameter>--with-lineeditlibs=readline</parameter>: This switch
|
---|
176 | enables <application>Readline</application> support for
|
---|
177 | <command>ntpdc</command> and <command>ntpq</command> programs. If omitted,
|
---|
178 | <application>libedit</application> will be used if installed, otherwise no
|
---|
179 | readline capabilites will be compiled.
|
---|
180 | </para>
|
---|
181 |
|
---|
182 | </sect2>
|
---|
183 |
|
---|
184 | <sect2 role="configuration">
|
---|
185 | <title>Configuring ntp</title>
|
---|
186 |
|
---|
187 | <sect3 id="ntp-config">
|
---|
188 | <title>Config Files</title>
|
---|
189 |
|
---|
190 | <para>
|
---|
191 | <filename>/etc/ntp.conf</filename>
|
---|
192 | </para>
|
---|
193 |
|
---|
194 | <indexterm zone="ntp ntp-config">
|
---|
195 | <primary sortas="e-etc-ntp.conf">/etc/ntp.conf</primary>
|
---|
196 | </indexterm>
|
---|
197 |
|
---|
198 | </sect3>
|
---|
199 |
|
---|
200 | <sect3>
|
---|
201 | <title>Configuration Information</title>
|
---|
202 |
|
---|
203 | <para>
|
---|
204 | The following configuration file first defines various ntp
|
---|
205 | servers with open access from different continents. Second, it
|
---|
206 | creates a drift file where <command>ntpd</command> stores the
|
---|
207 | frequency offset and a pid file to store the
|
---|
208 | <command>ntpd</command> process ID. Third, it defines the location
|
---|
209 | for the leap-second definition file
|
---|
210 | <filename>/etc/ntp.leapseconds</filename>, that the
|
---|
211 | <command>update-leap</command> script checks and updates, when
|
---|
212 | necessary. This script can be run as a cron job and the
|
---|
213 | <application>ntp</application> developers recommend a frequency of
|
---|
214 | about three weeks for the updates. Since the documentation included
|
---|
215 | with the package is sparse, visit the ntp website at
|
---|
216 | <ulink url="http://www.ntp.org/"/> and
|
---|
217 | <ulink url="http://www.pool.ntp.org/"/> for more information.
|
---|
218 | </para>
|
---|
219 |
|
---|
220 | <screen role="root"><userinput>cat > /etc/ntp.conf << "EOF"
|
---|
221 | <literal># Asia
|
---|
222 | server 0.asia.pool.ntp.org
|
---|
223 |
|
---|
224 | # Australia
|
---|
225 | server 0.oceania.pool.ntp.org
|
---|
226 |
|
---|
227 | # Europe
|
---|
228 | server 0.europe.pool.ntp.org
|
---|
229 |
|
---|
230 | # North America
|
---|
231 | server 0.north-america.pool.ntp.org
|
---|
232 |
|
---|
233 | # South America
|
---|
234 | server 2.south-america.pool.ntp.org
|
---|
235 |
|
---|
236 | driftfile /var/lib/ntp/ntp.drift
|
---|
237 | pidfile /var/run/ntpd.pid
|
---|
238 |
|
---|
239 | leapfile /var/lib/ntp/ntp.leapseconds</literal>
|
---|
240 | EOF</userinput></screen>
|
---|
241 |
|
---|
242 | <para>
|
---|
243 | You may wish to add a <quote>Security session</quote>. For
|
---|
244 | explanations, see <ulink url=
|
---|
245 | "https://www.eecis.udel.edu/~mills/ntp/html/accopt.html#restrict"/>.
|
---|
246 | </para>
|
---|
247 |
|
---|
248 | <screen role="root"><userinput>cat >> /etc/ntp.conf << "EOF"
|
---|
249 | <literal># Security session
|
---|
250 | restrict default limited kod nomodify notrap nopeer noquery
|
---|
251 | restrict -6 default limited kod nomodify notrap nopeer noquery
|
---|
252 |
|
---|
253 | restrict 127.0.0.1
|
---|
254 | restrict ::1</literal>
|
---|
255 | EOF</userinput></screen>
|
---|
256 |
|
---|
257 | </sect3>
|
---|
258 |
|
---|
259 | <sect3 id="ntp-init">
|
---|
260 | <title>Synchronizing the Time</title>
|
---|
261 |
|
---|
262 | <para>
|
---|
263 | There are two options. Option one is to run <command>ntpd</command>
|
---|
264 | continuously and allow it to synchronize the time in a gradual manner.
|
---|
265 | The other option is to run <command>ntpd</command> periodically (using
|
---|
266 | cron) and update the time each time <command>ntpd</command> is
|
---|
267 | scheduled.
|
---|
268 | </para>
|
---|
269 |
|
---|
270 | <para>
|
---|
271 | If you choose Option one, then install the
|
---|
272 | <phrase revision="sysv"><filename>/etc/rc.d/init.d/ntp</filename>
|
---|
273 | init script</phrase>
|
---|
274 | <phrase revision="systemd"><filename>ntpd.service</filename>
|
---|
275 | unit</phrase>
|
---|
276 | included in the
|
---|
277 | <xref linkend="bootscripts" revision="sysv"/>
|
---|
278 | <xref linkend="systemd-units" revision="systemd"/> package.
|
---|
279 | </para>
|
---|
280 |
|
---|
281 | <indexterm zone="ntp ntp-init" revision="sysv">
|
---|
282 | <primary sortas="f-ntp">ntp</primary>
|
---|
283 | </indexterm>
|
---|
284 |
|
---|
285 | <indexterm zone="ntp ntp-init" revision="systemd">
|
---|
286 | <primary sortas="f-ntpd">ntpd.service</primary>
|
---|
287 | </indexterm>
|
---|
288 |
|
---|
289 | <screen role="root"><userinput>make install-ntpd</userinput></screen>
|
---|
290 |
|
---|
291 | <para>
|
---|
292 | If you prefer to run <command>ntpd</command> periodically, add the
|
---|
293 | following command to <systemitem class="username">root</systemitem>'s
|
---|
294 | <filename>crontab</filename>:
|
---|
295 | </para>
|
---|
296 |
|
---|
297 | <screen><literal>ntpd -q</literal></screen>
|
---|
298 |
|
---|
299 | <para revision="sysv">
|
---|
300 | Execute the following command if you would like to set the hardware
|
---|
301 | clock to the current system time at shutdown and reboot:
|
---|
302 | </para>
|
---|
303 |
|
---|
304 | <screen role="root" revision="sysv"><userinput>ln -v -sf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
|
---|
305 | ln -v -sf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock</userinput></screen>
|
---|
306 |
|
---|
307 | <para revision="sysv">
|
---|
308 | The other way around is already set up by LFS.
|
---|
309 | </para>
|
---|
310 |
|
---|
311 | </sect3>
|
---|
312 |
|
---|
313 | </sect2>
|
---|
314 |
|
---|
315 | <sect2 role="content">
|
---|
316 | <title>Contents</title>
|
---|
317 |
|
---|
318 | <segmentedlist>
|
---|
319 | <segtitle>Installed Programs</segtitle>
|
---|
320 | <segtitle>Installed Libraries</segtitle>
|
---|
321 | <segtitle>Installed Directories</segtitle>
|
---|
322 |
|
---|
323 | <seglistitem>
|
---|
324 | <seg>calc_tickadj, ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq,
|
---|
325 | ntptime, ntptrace, sntp, tickadj and update-leap</seg>
|
---|
326 | <seg>None</seg>
|
---|
327 | <seg>/usr/share/ntp,
|
---|
328 | /usr/share/doc/ntp-4.2.8 and
|
---|
329 | /var/lib/ntp</seg>
|
---|
330 | </seglistitem>
|
---|
331 | </segmentedlist>
|
---|
332 |
|
---|
333 | <variablelist>
|
---|
334 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
335 | <?dbfo list-presentation="list"?>
|
---|
336 | <?dbhtml list-presentation="table"?>
|
---|
337 |
|
---|
338 | <varlistentry id="calc_tickadj">
|
---|
339 | <term><command>calc_tickadj</command></term>
|
---|
340 | <listitem>
|
---|
341 | <para>
|
---|
342 | calculates optimal value for tick given ntp drift file
|
---|
343 | </para>
|
---|
344 | <indexterm zone="ntp calc_tickadj">
|
---|
345 | <primary sortas="b-calc_tickadj">calc_tickadj</primary>
|
---|
346 | </indexterm>
|
---|
347 | </listitem>
|
---|
348 | </varlistentry>
|
---|
349 |
|
---|
350 | <varlistentry id="ntp-keygen">
|
---|
351 | <term><command>ntp-keygen</command></term>
|
---|
352 | <listitem>
|
---|
353 | <para>
|
---|
354 | generates cryptographic data files used by the NTPv4 authentication
|
---|
355 | and identification schemes
|
---|
356 | </para>
|
---|
357 | <indexterm zone="ntp ntp-keygen">
|
---|
358 | <primary sortas="b-ntp-keygen">ntp-keygen</primary>
|
---|
359 | </indexterm>
|
---|
360 | </listitem>
|
---|
361 | </varlistentry>
|
---|
362 |
|
---|
363 | <varlistentry id="ntp-wait">
|
---|
364 | <term><command>ntp-wait</command></term>
|
---|
365 | <listitem>
|
---|
366 | <para>
|
---|
367 | is useful at boot time, to delay the boot sequence until
|
---|
368 | <command>ntpd</command> has set the time
|
---|
369 | </para>
|
---|
370 | <indexterm zone="ntp ntp-wait">
|
---|
371 | <primary sortas="b-ntp-wait">ntp-wait</primary>
|
---|
372 | </indexterm>
|
---|
373 | </listitem>
|
---|
374 | </varlistentry>
|
---|
375 |
|
---|
376 | <varlistentry id="ntpd">
|
---|
377 | <term><command>ntpd</command></term>
|
---|
378 | <listitem>
|
---|
379 | <para>
|
---|
380 | is a ntp daemon that runs in the background and keeps
|
---|
381 | the date and time synchronized based on response from configured
|
---|
382 | ntp servers. It also functions as a ntp server
|
---|
383 | </para>
|
---|
384 | <indexterm zone="ntp ntpd">
|
---|
385 | <primary sortas="b-ntpd">ntpd</primary>
|
---|
386 | </indexterm>
|
---|
387 | </listitem>
|
---|
388 | </varlistentry>
|
---|
389 |
|
---|
390 | <varlistentry id="ntpdate">
|
---|
391 | <term><command>ntpdate</command></term>
|
---|
392 | <listitem>
|
---|
393 | <para>
|
---|
394 | is a client program that sets the date and time based on
|
---|
395 | the response from an ntp server. This command is deprecated
|
---|
396 | </para>
|
---|
397 | <indexterm zone="ntp ntpdate">
|
---|
398 | <primary sortas="b-ntpdate">ntpdate</primary>
|
---|
399 | </indexterm>
|
---|
400 | </listitem>
|
---|
401 | </varlistentry>
|
---|
402 |
|
---|
403 | <varlistentry id="ntpdc">
|
---|
404 | <term><command>ntpdc</command></term>
|
---|
405 | <listitem>
|
---|
406 | <para>
|
---|
407 | is used to query the ntp daemon about its current state
|
---|
408 | and to request changes in that state
|
---|
409 | </para>
|
---|
410 | <indexterm zone="ntp ntpdc">
|
---|
411 | <primary sortas="b-ntpdc">ntpdc</primary>
|
---|
412 | </indexterm>
|
---|
413 | </listitem>
|
---|
414 | </varlistentry>
|
---|
415 |
|
---|
416 | <varlistentry id="ntpq">
|
---|
417 | <term><command>ntpq</command></term>
|
---|
418 | <listitem>
|
---|
419 | <para>
|
---|
420 | is a utility program used to monitor <command>ntpd</command>
|
---|
421 | operations and determine performance
|
---|
422 | </para>
|
---|
423 | <indexterm zone="ntp ntpq">
|
---|
424 | <primary sortas="b-ntpq">ntpq</primary>
|
---|
425 | </indexterm>
|
---|
426 | </listitem>
|
---|
427 | </varlistentry>
|
---|
428 |
|
---|
429 | <varlistentry id="ntptime">
|
---|
430 | <term><command>ntptime</command></term>
|
---|
431 | <listitem>
|
---|
432 | <para>
|
---|
433 | reads and displays time-related kernel variables
|
---|
434 | </para>
|
---|
435 | <indexterm zone="ntp ntptime">
|
---|
436 | <primary sortas="b-ntptime">ntptime</primary>
|
---|
437 | </indexterm>
|
---|
438 | </listitem>
|
---|
439 | </varlistentry>
|
---|
440 |
|
---|
441 | <varlistentry id="ntptrace">
|
---|
442 | <term><command>ntptrace</command></term>
|
---|
443 | <listitem>
|
---|
444 | <para>
|
---|
445 | traces a chain of ntp servers back to the primary source
|
---|
446 | </para>
|
---|
447 | <indexterm zone="ntp ntptrace">
|
---|
448 | <primary sortas="b-ntptrace">ntptrace</primary>
|
---|
449 | </indexterm>
|
---|
450 | </listitem>
|
---|
451 | </varlistentry>
|
---|
452 |
|
---|
453 | <varlistentry id="sntp">
|
---|
454 | <term><command>sntp</command></term>
|
---|
455 | <listitem>
|
---|
456 | <para>
|
---|
457 | is a Simple Network Time Protocol (SNTP) client
|
---|
458 | </para>
|
---|
459 | <indexterm zone="ntp sntp">
|
---|
460 | <primary sortas="b-sntp">sntp</primary>
|
---|
461 | </indexterm>
|
---|
462 | </listitem>
|
---|
463 | </varlistentry>
|
---|
464 |
|
---|
465 | <varlistentry id="tickadj">
|
---|
466 | <term><command>tickadj</command></term>
|
---|
467 | <listitem>
|
---|
468 | <para>
|
---|
469 | reads, and optionally modifies, several timekeeping-related
|
---|
470 | variables in older kernels that do not have support for precision
|
---|
471 | timekeeping
|
---|
472 | </para>
|
---|
473 | <indexterm zone="ntp tickadj">
|
---|
474 | <primary sortas="b-tickadj">tickadj</primary>
|
---|
475 | </indexterm>
|
---|
476 | </listitem>
|
---|
477 | </varlistentry>
|
---|
478 |
|
---|
479 | <varlistentry id="update-leap">
|
---|
480 | <term><command>update-leap</command></term>
|
---|
481 | <listitem>
|
---|
482 | <para>
|
---|
483 | is a script to verify and, if necessary, update the leap-second
|
---|
484 | definition file
|
---|
485 | </para>
|
---|
486 | <indexterm zone="ntp update-leap">
|
---|
487 | <primary sortas="b-update-leap">update-leap</primary>
|
---|
488 | </indexterm>
|
---|
489 | </listitem>
|
---|
490 | </varlistentry>
|
---|
491 |
|
---|
492 | </variablelist>
|
---|
493 |
|
---|
494 | </sect2>
|
---|
495 |
|
---|
496 | </sect1>
|
---|