Difference between revisions of "NTP"

From CBLFS
Jump to navigationJump to search
(Bootscript)
Line 27: Line 27:
  
 
  ./configure --prefix=/usr --bindir=/usr/sbin \
 
  ./configure --prefix=/usr --bindir=/usr/sbin \
     --sysconfdir=/etc --cache-file=config.cache &&
+
     --sysconfdir=/etc --with-binsubdir=sbin \
 +
    --enable-shared --cache-file=config.cache &&
 
  make
 
  make
  
Line 47: Line 48:
 
Compile the package:
 
Compile the package:
 
   
 
   
  CC="gcc ${BUILD32}" USE_ARCH=32 ./configure --prefix=/usr \
+
  CC="gcc ${BUILD32}" USE_ARCH=32 ./configure --prefix=/usr \
--bindir=/usr/sbin --sysconfdir=/etc --cache-file=config.cache &&
+
    --bindir=/usr/sbin --sysconfdir=/etc --with-binsubdir=sbin \
 +
    --libdir=/usr/lib --enable-shared --cache-file=config.cache &&
 
  make
 
  make
  
Line 66: Line 68:
 
   
 
   
 
  CC="gcc ${BUILDN32}" USE_ARCH=n32 ./configure  --prefix=/usr \
 
  CC="gcc ${BUILDN32}" USE_ARCH=n32 ./configure  --prefix=/usr \
  --bindir=/usr/sbin --sysconfdir=/etc --cache-file=config.cache &&
+
  --bindir=/usr/sbin --sysconfdir=/etc --with-binsubdir=sbin \
 +
    --libdir=/usr/lib32 --enable-shared --cache-file=config.cache &&
 
  make
 
  make
  
Line 84: Line 87:
 
   
 
   
 
  CC="gcc ${BUILD64}" USE_ARCH=64 ./configure  --prefix=/usr \
 
  CC="gcc ${BUILD64}" USE_ARCH=64 ./configure  --prefix=/usr \
     --bindir=/usr/sbin --sysconfdir=/etc --cache-file=config.cache &&
+
     --bindir=/usr/sbin --sysconfdir=/etc --with-binsubdir=sbin \
 +
    --libdir=/usr/lib64 --enable-shared --cache-file=config.cache &&
 
  make
 
  make
  

Revision as of 19:11, 1 January 2008

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.

32Bit

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 ${BUILD32}" USE_ARCH=32 ./configure --prefix=/usr \
    --bindir=/usr/sbin --sysconfdir=/etc --with-binsubdir=sbin \
    --libdir=/usr/lib --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/

N32

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 ${BUILDN32}" USE_ARCH=n32 ./configure  --prefix=/usr \
--bindir=/usr/sbin --sysconfdir=/etc --with-binsubdir=sbin \
    --libdir=/usr/lib32 --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/

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 \
    --libdir=/usr/lib64 --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):

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
Retrieved from "?title=NTP&oldid=12506"