source: networking/netprogs/ntp.xml@ a1b111f8

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt perl-modules 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 a1b111f8 was b3dc2ba, checked in by Pierre Labastie <pieere@…>, 7 years ago

Fix update-leap script on NTP page

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@18542 af4574ff-66df-0310-9fd7-8a98e5e911e0

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