サーバーの時刻合わせ

インストール

$ su -
# yum -y install chrony

chrony 設定

NTPサーバーのIPアドレスを書き換えます。

# vi /etc/chrony.conf

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server ntp.jst.mfeed.ad.jp iburst

設定が終わったら再起動。

# systemctl restart chronyd.service

動作確認。

# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* ntp1.jst.mfeed.ad.jp          2   6    17     0   -233us[-3105us] +/-   86ms

自動起動サービスに登録。

# systemctl enable chronyd.service

強制的に同期

# chronyc -a makestep

一時的に日時を変更する場合

chrony を停止

# systemctl stop chronyd.service

日時の変更

# date --set='2018/03/01 00:00:00'

日付を戻す

# systemctl start chronyd.service; chronyc -a makestep

centos/v7/サーバーの時刻合わせ.txt · 最終更新: 2018/03/18 09:56 (外部編集)
 
特に明示されていない限り、本Wikiの内容は次のライセンスに従います: CC Attribution-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki