Akio's Log

ソフトウェア開発、プロジェクトマネジメント、プログラミング、ランニングなどなど

自分サーバの構築その9:NTPサーバの導入

自動で時刻合わせをするために、NTPサーバをインストールする。

再度、こちらのサイトを参考に。
「NTPサーバー構築(ntpd) - CentOS自宅サーバー構築」
http://centossrv.com/ntp.shtml

[root@xxxxxx ~]# yum -y install ntp
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for ntp to pack into transaction set.
ntp-4.2.2p1-5.el5.i386.rp 100% |=========================|  36 kB    00:00
---> Package ntp.i386 0:4.2.2p1-5.el5 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 ntp                     i386       4.2.2p1-5.el5    base              1.3 M

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 1.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): ntp-4.2.2p1-5.el5. 100% |=========================| 1.3 MB    00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: ntp                          ######################### [1/1]

Installed: ntp.i386 0:4.2.2p1-5.el5
Complete!

既存の/etc/ntp.confファイルをリネームして、新規でntp.confファイルを作成して編集する。

[root@xxxxxx ~]# mv /etc/ntp.conf /etc/ntp.conf.org
[root@xxxxxx ~]# vi /etc/ntp.conf
driftfile /var/lib/ntp/drift
server ntp.nict.jp
server ntp.dnsbalance.ring.gr.jp
server ntp.dnsbalance.ring.gr.jp
server ntp.dnsbalance.ring.gr.jp

2行目の「ntp.nict.jp」はこちらのサイトを参考にした。

ntp.nict.jp

その下の3行は

一番近いNTPサーバーを自動的にさがしてくれるサーバー

だそうだ。

NTPサーバの初回設定と、自動起動設定などを実行。

[root@xxxxxx ~]# ntpdate ntp.dnsbalance.ring.gr.jp
14 Jun 15:38:12 ntpdate[5759]: step time server 133.243.3.209 offset 252.460196 sec
[root@xxxxxx ~]# service ntpd start
ntpd を起動中:                                             [  OK  ]
[root@xxxxxx ~]# chkconfig ntpd on

これでOKなのだが、現在のCentOSはVMWareServer上で実行していて、どうも時計がずれやすい。
後で原因を調べてみないと。