・Chrony のインストール

時刻(NTP)サーバーは標準でインストールされるが念のため確認します

[root@alma]# dnf list installed | grep chrony
chrony.x86_64※インストールされている

もしインストールされていなければインストールします

[root@alma]# dnf -y install chrony

・ntp の設定

[root@alma]# vi /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
pool 2.almalinux.pool.ntp.org iburst
※書き換え
pool ntp.nict.jp iburst※独立行政法人 情報通信研究機構のNTPサーバーに変更(日本標準時)

# Use NTP servers from DHCP.
sourcedir /run/chrony-dhcp

# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16
※コメントを解除して書き換え LAN 内からの時刻同期を許可
allow 192.168.1.0/24

≪ 以下省略 ≫


・ntp の起動

[root@alma]# systemctl start chronyd


・ntpd の自動起動設定

[root@alma]# systemctl enable chronyd


・自動起動設定の確認

[root@alma]# systemctl is-enabled chronyd
enabled※enabled になっていればOK

・ntp の起動 &時刻調整の確認
[root@alma]# chronyc sources
MS Name/IP addressStratum Poll Reach LastRx Last sample
===================================================================================
^* mail1.marinecat.net 2 10 377 290 +72us[ +270us] +/- 3913us
^- time.cloudflare.com 3 10 377 299 -553us[ -355us] +/- 59ms
^- ap-northeast-1.clearnet.> 2 10 377 182 -158us[ -126us] +/- 39ms
^- mail.moe.cat 2 10 377 959 +797us[ +988us] +/- 35ms
^+ 2404:1a8:1102::a 2 10 377 192 +808us[ +808us] +/- 6806us
^+ 2404:1a8:1102::b 2 10 377 96 -185us[ -185us] +/- 7327us

上記ではまだ設定した NTP サーバーと同期が取れていないので20~30分ぐらい経ってから再度実行します

20~30分後に再度実行した結果

^* ntp-b3.nict.go.jp
^- ntp-k1.nict.jp
^+ ntp-b2.nict.go.jp
^+ ntp-a3.nict.go.jp

と表示されサーバー名の前に「*」と「+」が表示されていましたので同期がとれました

「*」 = メインサーバー
「+」 = サブサーバー