ぼくのいきかた

ゆるくやりまする

時間調整

今日はサーバの時間を同期するコマンドについて書きます。

 

そもそもどうやって時間を確認するのかというと、

dateコマンドを使います。

f:id:kidaiki:20190813181829p:plain

 

 

こんな感じ

 

今回は調整済なので、参考にならないかもしれませんが、

 

手順は以下です。

 

yum search chronyコマンドと打ってみましょう。

 

読み込んだプラグイン:fastestmirror
[2019-08-13 17:27:34.048] Loading mirror speeds from cached hostfile
[2019-08-13 17:27:34.083] * base: ftp-srv2.kddilabs.jp
[2019-08-13 17:27:34.083] * extras: ftp-srv2.kddilabs.jp
[2019-08-13 17:27:34.083] * updates: ftp-srv2.kddilabs.jp
[2019-08-13 17:27:34.154] ================================================== N/S matched: chrony ==================================================
[2019-08-13 17:27:34.154] chrony.x86_64 : An NTP client/server

 

↑のように表示されればchronyの検索ができました。

 

それではインストールしてみましょう。

yum install chrony.x86_64 と打ってみましょう。

[2019-08-13 17:27:56.544] 読み込んだプラグイン:fastestmirror
[2019-08-13 17:27:56.599] Loading mirror speeds from cached hostfile
[2019-08-13 17:27:56.638] * base: ftp-srv2.kddilabs.jp
[2019-08-13 17:27:56.638] * extras: ftp-srv2.kddilabs.jp
[2019-08-13 17:27:56.638] * updates: ftp-srv2.kddilabs.jp
[2019-08-13 17:27:56.827] 依存性の解決をしています
[2019-08-13 17:27:56.827] --> トランザクションの確認を実行しています。
[2019-08-13 17:27:56.827] ---> パッケージ chrony.x86_64 0:3.2-2.el7 を インストール
[2019-08-13 17:27:56.836] --> 依存性の処理をしています: libseccomp.so.2()(64bit) のパッケージ: chrony-3.2-2.el7.x86_64
[2019-08-13 17:27:56.980] --> トランザクションの確認を実行しています。
[2019-08-13 17:27:56.980] ---> パッケージ libseccomp.x86_64 0:2.3.1-3.el7 を インストール
[2019-08-13 17:27:57.164] --> 依存性解決を終了しました。
[2019-08-13 17:27:57.251]
[2019-08-13 17:27:57.251] 依存性を解決しました
[2019-08-13 17:27:57.263]
[2019-08-13 17:27:57.263] =========================================================================================================================
[2019-08-13 17:27:57.263] Package アーキテクチャー バージョン リポジトリー 容量
[2019-08-13 17:27:57.263] =========================================================================================================================
[2019-08-13 17:27:57.263] インストール中:
[2019-08-13 17:27:57.263] chrony x86_64 3.2-2.el7 base 243 k
[2019-08-13 17:27:57.263] 依存性関連でのインストールをします:
[2019-08-13 17:27:57.263] libseccomp x86_64 2.3.1-3.el7 base 56 k
[2019-08-13 17:27:57.263]
[2019-08-13 17:27:57.263] トランザクションの要約
[2019-08-13 17:27:57.263] =========================================================================================================================
[2019-08-13 17:27:57.263] インストール 1 パッケージ (+1 個の依存関係のパッケージ)
[2019-08-13 17:27:57.263]
[2019-08-13 17:27:57.263] 総ダウンロード容量: 299 k
[2019-08-13 17:27:57.263] インストール容量: 773 k
[2019-08-13 17:27:57.270] Is this ok [y/d/N]: y
[2019-08-13 17:27:58.807] Downloading packages:
[2019-08-13 17:27:58.901] (1/2): libseccomp-2.3.1-3.el7.x86_64.rpm | 56 kB 00:00:00
[2019-08-13 17:27:58.986] (2/2): chrony-3.2-2.el7.x86_64.rpm | 243 kB 00:00:00
[2019-08-13 17:27:59.004] -------------------------------------------------------------------------------------------------------------------------
[2019-08-13 17:27:59.004] 合計 1.5 MB/s | 299 kB 00:00:00
[2019-08-13 17:27:59.004] Running transaction check
[2019-08-13 17:27:59.012] Running transaction test
[2019-08-13 17:27:59.034] Transaction test succeeded
[2019-08-13 17:27:59.044] Running transaction
[2019-08-13 17:27:59.139] インストール中 : libseccomp-2.3.1-3.el7.x86_64 [ ] 1/2 インストール中 : libseccomp-2.3.1-3.el7.x86_64 [########### ] 1/2 インストール中 : libseccomp-2.3.1-3.el7.x86_64 [####################### ] 1/2 インストール中 : libseccomp-2.3.1-3.el7.x86_64 [################################### ] 1/2 インストール中 : libseccomp-2.3.1-3.el7.x86_64 [############################################### ] 1/2 インストール中 : libseccomp-2.3.1-3.el7.x86_64 [################################################ ] 1/2 インストール中 : libseccomp-2.3.1-3.el7.x86_64 [################################################# ] 1/2 インストール中 : libseccomp-2.3.1-3.el7.x86_64 [################################################## ] 1/2 インストール中 : libseccomp-2.3.1-3.el7.x86_64 [####################################################### ] 1/2 インストール中 : libseccomp-2.3.1-3.el7.x86_64 1/2
[2019-08-13 17:27:59.308] インストール中 : chrony-3.2-2.el7.x86_64 [ ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [######## ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [########### ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [############ ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [#################### ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [############################# ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [##################################### ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [############################################# ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [############################################### ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [################################################## ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [##################################################### ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [####################################################### ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [######################################################### ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 [############################################################# ] 2/2 インストール中 : chrony-3.2-2.el7.x86_64 2/2
[2019-08-13 17:27:59.429] 検証中 : libseccomp-2.3.1-3.el7.x86_64 1/2
[2019-08-13 17:27:59.445] 検証中 : chrony-3.2-2.el7.x86_64 2/2
[2019-08-13 17:27:59.531]
[2019-08-13 17:27:59.531] インストール:
[2019-08-13 17:27:59.531] chrony.x86_64 0:3.2-2.el7
[2019-08-13 17:27:59.531]
[2019-08-13 17:27:59.531] 依存性関連をインストールしました:
[2019-08-13 17:27:59.531] libseccomp.x86_64 0:2.3.1-3.el7
[2019-08-13 17:27:59.531]
[2019-08-13 17:27:59.531] 完了しました!

 

 

長いですが、こんな感じ

 

 

chronyを起動してみましょう

systemctl start chronyd

 

確認

systemctl status chronyd

Activeと表示されたらOKです。

 

ystemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since 火 2019-09-17 08:54:58 JST; 2 weeks 6 days ago
Docs: man:chronyd(8)
man:chrony.conf(5)
Main PID: 720 (chronyd)
CGroup: /system.slice/chronyd.service
mq720 /usr/sbin/chronyd