/var/www/yatta47.log

/var/www/yatta47.log

やったのログ置場です。スクラップみたいな短編が多いかと。

Ubuntuにntpをインストール

家にあるUbuntuのサーバを今更ながら時間がおかしかったので、dateコマンドで合わせるんじゃなくて、せっかくだからntpでもインストールして合わせるかということでntpをインストールしました。

インストール自体は簡単。apt-get経由でインストールするだけ。

ubuntu@ubuntu-armhf:~$ sudo apt-get install ntp
[sudo] password for ubuntu: 
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下の特別パッケージがインストールされます:
  libopts25
提案パッケージ:
  ntp-doc apparmor
以下のパッケージが新たにインストールされます:
  libopts25 ntp
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 10 個。
596 kB のアーカイブを取得する必要があります。
この操作後に追加で 1,202 kB のディスク容量が消費されます。
続行しますか [Y/n]? Y
取得:1 http://ports.ubuntu.com/ubuntu-ports/ raring/main libopts25 armhf 1:5.17.1-1ubuntu2 [54.7 kB]
取得:2 http://ports.ubuntu.com/ubuntu-ports/ raring/main ntp armhf 1:4.2.6.p5+dfsg-2ubuntu1 [542 kB]
596 kB を 4秒 で取得しました (126 kB/s)
以前に未選択のパッケージ libopts25 を選択しています。
(データベースを読み込んでいます ... 現在 138481 個のファイルとディレクトリがインストールされています。)
(.../libopts25_1%3a5.17.1-1ubuntu2_armhf.deb から) libopts25 を展開しています...
以前に未選択のパッケージ ntp を選択しています。
(.../ntp_1%3a4.2.6.p5+dfsg-2ubuntu1_armhf.deb から) ntp を展開しています...
ureadahead のトリガを処理しています ...
man-db のトリガを処理しています ...
libopts25 (1:5.17.1-1ubuntu2) を設定しています ...
ntp (1:4.2.6.p5+dfsg-2ubuntu1) を設定しています ...
 * Starting NTP server ntpd                                                                                                      [ OK ] 
libc-bin のトリガを処理しています ...
ldconfig deferred processing now taking place
ureadahead のトリガを処理しています ...
ubuntu@ubuntu-armhf:~$ 

インストールが終わったら、そのあとは接続サーバ(リモート先)の追加を行います。

ubuntu@ubuntu-armhf:~$ sudo vi /etc/ntp.conf 

ここを追加。

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

# Use Ubuntu's ntp server as a fallback.
#server ntp.ubuntu.com
server ntp.nict.jp
server ntp.nict.jp
server ntp.nict.jp

その後はntpプロセスを再起動。

ubuntu@ubuntu-armhf:~$ sudo /etc/init.d/ntp restart
 * Stopping NTP server ntpd                                                                                                      [ OK ] 
 * Starting NTP server ntpd                                                                                                      [ OK ] 

で、このコマンドで確認

ubuntu@ubuntu-armhf:~$ sudo ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 routerida1.sopr 133.243.238.163  2 u   23   64    1   44.267   -4.969   0.004
 fnttkyo043241.t 17.83.253.7      3 u   22   64    1   34.932  -139.94   0.004
 y.ns.gin.ntt.ne 133.243.238.243  2 u   21   64    1   38.611   -8.631   0.004
 219x123x70x90.a 192.168.7.177    3 u   20   64    1   32.745   -8.265   0.004
 ntp-a3.nict.go. .NICT.           1 u   19   64    1   54.663  -20.179   0.004
 ntp-b2.nict.go. .NICT.           1 u   18   64    1   62.451  -23.567   0.004
 ntp-b3.nict.go. .NICT.           1 u   17   64    1   56.857  -21.185   0.004