テクノロジーによる教育支援への挑戦

テクノロジーによる学びの支援へのチャレンジについて書いていきます

Debian上でNTPで自動的に時刻を合わせる

Moodleサーバをインストールしたマシンだがどうも送られてくるメールの時間がずれている。そこで、NTPを利用して時刻合わせを自動化することにした。

debian:~# apt-get update
Get:1 ftp://www.ring.gr.jp stable/main Packages [3349kB]
Get:2 http://security.debian.org stable/updates/main Packages [208kB]
(中略)
Get:10 ftp://www.ring.gr.jp stable/main Release [97B]
Fetched 4897kB in 11s (429kB/s)
Reading Package Lists... Done
debian:~# apt-get install ntp ntpdate ntp-doc ntp-simple
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
ntp-server
The following NEW packages will be installed:
ntp ntp-doc ntp-server ntp-simple ntpdate
0 upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
Need to get 1337kB of archives.
After unpacking 3256kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 ftp://www.ring.gr.jp stable/main ntp 1:4.2.0a+stable-2sarge1 [255kB]
Get:2 ftp://www.ring.gr.jp stable/main ntp-doc 1:4.2.0a+stable-2sarge1 [889kB]
Get:3 ftp://www.ring.gr.jp stable/main ntp-simple 1:4.2.0a+stable-2sarge1 [120kB]
Get:4 ftp://www.ring.gr.jp stable/main ntp-server 1:4.2.0a+stable-2sarge1 [31.3kB]
Get:5 ftp://www.ring.gr.jp stable/main ntpdate 1:4.2.0a+stable-2sarge1 [41.6kB]
Fetched 1337kB in 3s (334kB/s)
Selecting previously deselected package ntp.
(Reading database ... 28184 files and directories currently installed.)
Unpacking ntp (from .../ntp_1%3a4.2.0a+stable-2sarge1_i386.deb) ...
Selecting previously deselected package ntp-doc.
Unpacking ntp-doc (from .../ntp-doc_1%3a4.2.0a+stable-2sarge1_all.deb) ...
Selecting previously deselected package ntp-simple.
Unpacking ntp-simple (from .../ntp-simple_1%3a4.2.0a+stable-2sarge1_i386.deb) ...
Selecting previously deselected package ntp-server.
Unpacking ntp-server (from .../ntp-server_1%3a4.2.0a+stable-2sarge1_i386.deb) ...
Removing any system startup links for /etc/init.d/ntp-simple ...
Removing any system startup links for /etc/init.d/ntp-refclock ...
Removing any system startup links for /etc/init.d/ntp ...
ntpd: no process killed
Selecting previously deselected package ntpdate.
Unpacking ntpdate (from .../ntpdate_1%3a4.2.0a+stable-2sarge1_i386.deb) ...
Setting up ntp (4.2.0a+stable-2sarge1) ...

Setting up ntp-doc (4.2.0a+stable-2sarge1) ...

Setting up ntpdate (4.2.0a+stable-2sarge1) ...
Running ntpdate to synchronize clock.

Setting up ntp-simple (4.2.0a+stable-2sarge1) ...

Setting up ntp-server (4.2.0a+stable-2sarge1) ...
Starting NTP server: ntpd.

debian:~# date
Thu Mar 23 22:13:17 JST 2006
debian:~# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
66.187.224.4 .CDMA. 1 u 41 64 1 197.727 -0.682 0.001
127.127.1.0 LOCAL(0) 13 l 41 64 1 0.000 0.000 0.001

無事に時間が合いました。めでたし。