LoginSignup
0
2

More than 3 years have passed since last update.

Centos7|amazonlinux2の時間がずれた

Last updated at Posted at 2018-07-30

状況

きっかけとしてeb createコマンドがこけて気が付きました。

error.shell

$ eb create examplecojp-env --database --timeout 30
ERROR: NotAuthorizedError - Operation Denied. Signature expired: 20180729T223841Z is now earlier than 20180729T225031Z (20180729T225531Z - 5 min.)

調査

何やらntpというものがあり時間を調整してくれるシステムとのこと
で、Chronyというツールがcentos7の標準デーモンとなったとのことなので
こちらをインストールしてみる。

chronyインストール

install.shell

$ yum install -y chrony

設定

日本の標準時間を作っているNICTという機関があり
そちらに合わせる形でchronyを設定していく。
設定ファイルの場所はこちら
/etc/chrony.conf

/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

# 追記するのは以下2行
server ntp.nict.jp iburst
stratumweight 0

chronyの自動起動設定

autostart.shell

$ systemctl start chronyd


起動、状態確認

up.shell

$ systemctl status chronyd

起動直後は同期されない

ので強制的に同期するようにします。

sync.shell

$ chronyc -a makestep
#ここで501エラーが出たらsudoを頭につけて実行してみる
$ sudo chronyc -a makestep
#200が帰って来れば成功

確認

dateコマンドで確認します。

date.shell

$ date

原因

つかみかねております。
windows10+virtualbox+vagrantな仮想環境で動かしているのですが
よくわかっておりません。
もし確認ポイントなどご存知でしたらコメントいただければ嬉しいです。

追記

amazonlinuxでも適用できたのでタイトルに追記しました。

0
2
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
0
2