ntpサーバで時刻同期設定

ntpで時刻設定することがあったので、メモ。


1.ntpをインストール
 yum install -y ntp

2.時刻をサーバに問い合わせて同期
 ntpdate ntp.nict.jp (※このntp.nict.jpは日本標準時プロジェクトのntpサーバです。)

3.ntpの設定ファイルを変更
 vim /etc/ntp.conf

 server 0.centos.pool.ntp.org
 server 1.centos.pool.ntp.org
 server 2.centos.pool.ntp.org

 上記の箇所を下記に変更

 server -4 ntp.nict.jp
 server -4 ntp1.jst.mfeed.ad.jp
 server -4 ntp2.jst.mfeed.ad.jp

 ※VPSとかだと、変更権限が無いかも…

4.ntpdの起動
 /etc/init.d/ntpd start

5.自動起動の設定
 chkconfig ntpd on

6.ntpdのステータス確認
 ntpq -p

コメント