Difference between revisions of "NTP"

From CBLFS
Jump to navigationJump to search
 
(16 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
{| style="text-align: left; background-color: AliceBlue;"
 
{| style="text-align: left; background-color: AliceBlue;"
|-
+
|-valign="top"
 
!Download Source:
 
!Download Source:
| http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-{{NTP-Version}}.tar.gz
+
| http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-{{NTP-Version}}.tar.gz
 
|}
 
|}
  
 
----
 
----
  
== Introdction to NTP ==
+
{{Package-Introduction|The NTP package contains a client and server to keep the time synchronized between various computers over a network. This package is the official reference implementation of the NTP protocol.|http://www.ntp.org/}}
 
 
The NTP package contains a client and server to keep the time synchronized between various computers over a network. This package is the official reference implementation of the NTP protocol.  
 
  
 
== Dependencies ==
 
== Dependencies ==
Line 15: Line 13:
 
=== Optional ===
 
=== Optional ===
 
*[[OpenSSL]]
 
*[[OpenSSL]]
 +
 +
== Additional Configuration Options ==
 +
 +
''--with-crypto'': Enables [[OpenSSL]] support.
  
 
== Non-Multilib ==
 
== Non-Multilib ==
 +
 +
[[Silc-toolkit]] provides a md5.h that is incompatible with NTP. Add the following entry to config.cache to make sure the header isn't used:
 +
 +
echo "ac_cv_header_md5_h=no" > config.cache
  
 
Compile the package:
 
Compile the package:
  
 
  ./configure --prefix=/usr --bindir=/usr/sbin \
 
  ./configure --prefix=/usr --bindir=/usr/sbin \
     --sysconfdir=/etc &&
+
     --sysconfdir=/etc --with-binsubdir=sbin \
 +
    --enable-shared --cache-file=config.cache &&
 
  make
 
  make
  
Line 27: Line 34:
  
 
  make install
 
  make install
  install -v -m755 -d /usr/share/doc/ntp-{{NTP-Version}} &&
+
  install -dv -m755 /usr/share/doc/ntp-{{NTP-Version}} &&
  cp -v -R html /usr/share/doc/ntp-{{NTP-Version}}/
+
  cp -Rv html /usr/share/doc/ntp-{{NTP-Version}}/
  
 
== Multilib ==
 
== Multilib ==
 +
 
'''''This package does not provide any libraries so only one installation is needed.'''''
 
'''''This package does not provide any libraries so only one installation is needed.'''''
  
=== 32Bit ===
+
=== 64Bit ===
 +
 
 +
[[Silc-toolkit]] provides a md5.h that is incompatible with NTP. Add the following entry to config.cache to make sure the header isn't used:
 +
 
 +
echo "ac_cv_header_md5_h=no" > config.cache
  
 
Compile the package:
 
Compile the package:
 
   
 
   
  CC="gcc ${BUILD32}" USE_ARCH=32 ./configure  --prefix=/usr \
+
  CC="gcc ${BUILD64}" USE_ARCH=64 ./configure  --prefix=/usr \
--bindir=/usr/sbin --sysconfdir=/etc &&
+
    --bindir=/usr/sbin --sysconfdir=/etc --with-binsubdir=sbin \
 +
    --enable-shared --cache-file=config.cache &&
 
  make
 
  make
  
Line 44: Line 57:
  
 
  make install &&
 
  make install &&
  install -v -m755 -d /usr/share/doc/ntp-{{NTP-Version}} &&
+
  install -dv -m755 /usr/share/doc/ntp-{{NTP-Version}} &&
  cp -v -R html /usr/share/doc/ntp-{{NTP-Version}}/
+
  cp -Rv html /usr/share/doc/ntp-{{NTP-Version}}/
 +
 
 +
== Configuring ==
  
=== N32 ===
+
=== Configuration File ===
  
Please Contribute this section.
+
/etc/ntp.conf
  
=== 64Bit ===
+
=== Configuration Information ===
 +
 
 +
You will need to create an ntp.conf file so that ntp knows where to go find ntp servers from which it can get the current time. Here is a sample ntp.conf file suitable for the United States:
  
Compile the package:
+
cat > /etc/ntp.conf << "EOF"
   
+
  server 0.us.pool.ntp.org
  CC="gcc ${BUILD64}" USE_ARCH=64 ./configure --prefix=/usr \
+
  server 1.us.pool.ntp.org
    --bindir=/usr/sbin --sysconfdir=/etc &&
+
  server 2.us.pool.ntp.org
  make
+
driftfile /var/cache/ntp.drift
 +
  EOF
  
Install the package
+
Of course, if you live elsewhere, you are going to want to list servers closer to home - though ntp should be able to work just fine with any server that you choose. A list of servers can be found at http://www.pool.ntp.org/. Just click on your continent on the right and you'll find your way to a list of servers for your area. You can then replace the ''server ....'' lines with servers closer to home.
  
make install &&
+
The ntp.drift file allows ntp to compute the error in the intrinsic frequency of the clock on the computer it is running on, helping to keep the time on the computer correct.
install -v -m755 -d /usr/share/doc/ntp-{{NTP-Version}} &&
 
cp -v -R html /usr/share/doc/ntp-{{NTP-Version}}/
 
  
== Configuring ==
+
Also, if you want more detailed documentation, have a look at http://www.ntp.org/.
  
 
=== Bootscript ===
 
=== Bootscript ===
  
Install the init script provided by the [[blfs-bootscripts]] package:
+
If you want '''ntp''' to always be running, install the init script provided by the [[bootscripts]] package:
  
 
  make install-ntp
 
  make install-ntp
  ln -v -sf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
+
 
  ln -v -sf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock
+
If you want '''ntp''' to run only periodically, then add the following line to root's crontab (see [[Fcron]] or [[Vixie-Cron]]):
 +
 
 +
ntpd -q
 +
 
 +
{{Note|If your computer will not always have an active internet connection on boot, then you should use the crontab approach. If you do not have an active internet connection when blfs-bootscripts' ntp script runs, then your computer will not finish booting. It will sit there attempting to contact one of the ntp servers and it's not smart enough to figure out that you do not have an active internet connection. It's a problem similar to if you have [[dhcpcd]] installed without either [[ifplugd]] or [[netplug]].}}
 +
 
 +
Link over clfs-bootscripts' setclock script so that the hardware clock is set when the computer shuts down or reboots.
 +
 
 +
  ln -svf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
 +
  ln -svf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock
 +
 
 +
== Contents ==
 +
 
 +
{| style="text-align: left;"
 +
|-valign="top"
 +
!Installed Directories:
 +
|None
 +
|-valign="top"
 +
!Installed Programs:
 +
|ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq, ntptime, ntptrace, sntp, tickadj
 +
|-valign="top"
 +
!Installed Libraries:
 +
|None
 +
|}
 +
 
 +
[[Category:Network Applications]]

Latest revision as of 06:27, 12 January 2014

Download Source: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p10.tar.gz

Introduction to NTP

The NTP package contains a client and server to keep the time synchronized between various computers over a network. This package is the official reference implementation of the NTP protocol.

Project Homepage: http://www.ntp.org/

Dependencies

Optional

Additional Configuration Options

--with-crypto: Enables OpenSSL support.

Non-Multilib

Silc-toolkit provides a md5.h that is incompatible with NTP. Add the following entry to config.cache to make sure the header isn't used:

echo "ac_cv_header_md5_h=no" > config.cache

Compile the package:

./configure --prefix=/usr --bindir=/usr/sbin \
    --sysconfdir=/etc --with-binsubdir=sbin \
    --enable-shared --cache-file=config.cache &&
make

Install the package

make install
install -dv -m755 /usr/share/doc/ntp-4.2.8p10 &&
cp -Rv html /usr/share/doc/ntp-4.2.8p10/

Multilib

This package does not provide any libraries so only one installation is needed.

64Bit

Silc-toolkit provides a md5.h that is incompatible with NTP. Add the following entry to config.cache to make sure the header isn't used:

echo "ac_cv_header_md5_h=no" > config.cache

Compile the package:

CC="gcc ${BUILD64}" USE_ARCH=64 ./configure  --prefix=/usr \
    --bindir=/usr/sbin --sysconfdir=/etc --with-binsubdir=sbin \
    --enable-shared --cache-file=config.cache &&
make

Install the package

make install &&
install -dv -m755 /usr/share/doc/ntp-4.2.8p10 &&
cp -Rv html /usr/share/doc/ntp-4.2.8p10/

Configuring

Configuration File

/etc/ntp.conf

Configuration Information

You will need to create an ntp.conf file so that ntp knows where to go find ntp servers from which it can get the current time. Here is a sample ntp.conf file suitable for the United States:

cat > /etc/ntp.conf << "EOF"
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
driftfile /var/cache/ntp.drift
EOF

Of course, if you live elsewhere, you are going to want to list servers closer to home - though ntp should be able to work just fine with any server that you choose. A list of servers can be found at http://www.pool.ntp.org/. Just click on your continent on the right and you'll find your way to a list of servers for your area. You can then replace the server .... lines with servers closer to home.

The ntp.drift file allows ntp to compute the error in the intrinsic frequency of the clock on the computer it is running on, helping to keep the time on the computer correct.

Also, if you want more detailed documentation, have a look at http://www.ntp.org/.

Bootscript

If you want ntp to always be running, install the init script provided by the bootscripts package:

make install-ntp

If you want ntp to run only periodically, then add the following line to root's crontab (see Fcron or Vixie-Cron):

ntpd -q
Caution.png

Note

If your computer will not always have an active internet connection on boot, then you should use the crontab approach. If you do not have an active internet connection when blfs-bootscripts' ntp script runs, then your computer will not finish booting. It will sit there attempting to contact one of the ntp servers and it's not smart enough to figure out that you do not have an active internet connection. It's a problem similar to if you have dhcpcd installed without either ifplugd or netplug.

Link over clfs-bootscripts' setclock script so that the hardware clock is set when the computer shuts down or reboots.

ln -svf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
ln -svf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock

Contents

Installed Directories: None
Installed Programs: ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq, ntptime, ntptrace, sntp, tickadj
Installed Libraries: None
Retrieved from "?title=NTP&oldid=21598"