1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

CentOS7で時間がずれる際のchronyの設定方法

Posted at

CentOS7で時間がずれる際のchronyの設定方法

  • chronyとは?
CentOS7で標準で導入されているNTPクライアント(CentOS6まではntpdが導入されていた)
それぞれ違いはあるが、
chrony : 仮想感想など、NTPサーバと常時通信できない環境で有用
ntp : NTPサーバと常に通信できる環境で有用

chronyの設定

  • インストール
$ sudo yum install chrony
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp-srv2.kddilabs.jp
 * extras: ftp-srv2.kddilabs.jp
 * updates: ftp-srv2.kddilabs.jp
パッケージ chrony-3.4-1.el7.x86_64 はインストール済みか最新バージョンです
何もしません

標準でインストール済みで最新バージョンのようです。

  • 設定ファイルの変更
$ sudo vi /etc/chrony.conf 
# コメントアウト
# 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
server ntp.nict.jp iburst 
  • chronyの再起動
$ sudo systemctl restart chronyd
  • 同期の確認
$ chronyc sources
210 Number of sources = 2
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^- ntp1.jst.mfeed.ad.jp          2   6    17     7  -1686us[-1785us] +/-   61ms
^* ntp-k1.nict.jp                1   6    17     7    -84us[ -183us] +/-   10ms

^ はサーバを表す
- は受け入れ可能なサーバ
* は現在同期しているサーバ

  • 時間の確認
$ date
2020年  9月  1日 火曜日 21:00:25 JST

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?