Difference between revisions of "NTP"

From CBLFS
Jump to navigationJump to search
m
Line 100: Line 100:
 
  make install-ntp
 
  make install-ntp
  
If you want '''ntp''' to run only periodically, then add the following line to root's crontab (see [[Fcron]]):
+
If you want '''ntp''' to run only periodically, then add the following line to root's crontab (see [[Fcron]] or [[Vixie-Cron]]):
  
 
  ntpd -q
 
  ntpd -q

Revision as of 16:46, 29 August 2009

Download Source: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p10.tar.gz
Required Patch: http://svn.cross-lfs.org/svn/repos/patches/ntp/ntp-4.2.8p10-glibc-1.patch

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

Update NTP so it compiles cleanly with glibc version 2.9 or greater:

patch -Np1 -i ../ntp-4.2.4p7-glibc-1.patch

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

Update NTP so it compiles cleanly with glibc version 2.9 or greater:

patch -Np1 -i ../ntp-4.2.4p7-glibc-1.patch

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=18957"