This page describe the installation of NTPd as a server for other clients.
# md5sum -c ntp-4.2.8p10.tar.gz.md5 ntp-4.2.8p10.tar.gz: OK
# yum groupinstall "Development Tools" # yum install libcap-devel libevent-devel openssl-devel perl-File-Fetch.noarch
# systemctl stop ntpd
# yum remove ntp
# echo "exclude=ntp*" >> /etc/yum.conf
# userdel ntp
# tar zxf ntp-4.2.8p10.tar.gz
# cd ntp-4.2.8p10 # ./configure --enable-linuxcaps --docdir=/usr/share/doc/ntp-4.2.8p10
# make
driftfile /var/lib/ntp/drift restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery restrict 127.0.0.1 restrict ::1 # pick servers near to you! server ntp2.polaire.nl iburst server ntp0.nl.net iburst server ntp1.nl.net iburst server ntp.ring.nlnog.net iburst # Enable writing of statistics records. statistics clockstats cryptostats loopstats peerstats leapfile /var/lib/ntp/leap-seconds.list
# groupadd ntp
# useradd -d /var/lib/ntp -g ntp -s /bin/false ntp
# printf 'PATH=${PATH}:/usr/local/bin\n' > /etc/profile.d/ntp-path.sh
# install -v -o ntp -g ntp -d /var/lib/ntp
# cd ntp-4.2.8p10 # make install
# /usr/local/bin/ntpd -g -u ntp:ntp
# ntpd --version ntpd 4.2.8p10@1.3728-o Thu Jun 1 12:37:34 UTC 2017 (1)
Make sure your server can reach time.nist.gov over FTP.
use Digest::SHA qw(sha1_hex); use File::Copy qw(move); use File::Fetch; use Getopt::Long qw(:config auto_help no_ignore_case bundling); use Sys::Syslog;
update-leap
script. For example put the script below in /etc/cron.weekly/leap.sh#!/bin/bash # update leap file if necessary /usr/local/bin/update-leap -4 -s ftp://time.nist.gov/pub/leap-seconds.list # stop ntpd /bin/pkill ntpd # start ntpd if /bin/pgrep ntpd >/dev/null; then echo "NTP daemon did not stop! Not trying to start another one." else systemctl start ntpd fi
/etc/systemd/system/ntpd.service
[Unit] Description=Network Time Service After=syslog.target ntpdate.service sntp.service Conflicts=systemd-timesyncd.service [Service] Type=forking ExecStart=/usr/local/bin/ntpd -g -u ntp:ntp PrivateTmp=true [Install] WantedBy=multi-user.target
systemctl enable ntpd.service
systemctl start ntpd.service