2014年4月10日 星期四

ubuntu 12.04 install ntp server over http

1.install ntp server package
#apt-get update
#apt-get upgrade
#apt-get install ntp

2. modify ntp configuration
#vim /etc/ntp.conf

driftfile /var/lib/ntp/ntp.drift
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 127.127.1.0
restrict csp.garmin.com notrap nomodify nopeer noquery
restrict 192.168.200.0 mask 255.255.255.0
restrict 127.0.0.1
broadcast 192.168.200.255
disable auth
broadcastclient

3. restart ntp serivce
#/etc/init.d/ntp restart

4.add third party component to source.list
#vim /etc/apt/source.list
deb http://ppa.launchpad.net/landronimirc/htpdate/ubuntu precise main
deb-src http://ppa.launchpad.net/landronimirc/htpdate/ubuntu precise main

5.add ppa key
#app-apt-repository ppa:landronimirc/htpdate

6.update repository
#apt-get update

7. install htpdate package
#apt-get install htpdate

8.setting crontab
#vim /etc/crontab
* */6 * * * /usr/bin/htpdate -d http://www.perl.org

9. restart cron job
#/etc/init.d/cron restart