linux server 跑久了之後,系統時間難免會有誤差
以前的習慣是執行 ntpdate [ntp-server]
發現 CentOS 沒有這個 ntp client 的指令
[root@example ~]# ntpdate time.stdtime.gov.tw
-bash: ntpdate: command not found
所以試試用 yum 安裝 ntp 套件,喔喔,找不到這個套件!!??
[root@example ~]# yum -y install ntp
Last metadata expiration check: 0:02:43 ago on Mon 02 Aug 2021 11:00:28 AM CST.
No match for argument: ntp
Error: Unable to find a match: ntp
原來 CentOS 8 要安裝 chrony 套件來取代 ntp
[root@example ~]# yum -y install chrony
Last metadata expiration check: 0:04:50 ago on Mon 02 Aug 2021 11:00:28 AM CST.
Dependencies resolved.
=========================================
Package Architecture Version Repository Size
=========================================
Installing:
chrony x86_64 3.5-2.el8 baseos 270 k
Installing weak dependencies:
timedatex x86_64 0.5-3.el8 baseos 32 k
Transaction Summary
=========================================
Install 2 Packages
Total download size: 302 k
Installed size: 580 k
Downloading Packages:
(1/2): chrony-3.5-2.el8.x86_64.rpm 8.5 MB/s | 270 kB 00:00
(2/2): timedatex-0.5-3.el8.x86_64.rpm 235 kB/s | 32 kB 00:00
--------------------------------------------------------------------------------
Total 265 kB/s | 302 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : timedatex-0.5-3.el8.x86_64 1/2
Running scriptlet: timedatex-0.5-3.el8.x86_64 1/2
Running scriptlet: chrony-3.5-2.el8.x86_64 2/2
Installing : chrony-3.5-2.el8.x86_64 2/2
Running scriptlet: chrony-3.5-2.el8.x86_64 2/2
Verifying : chrony-3.5-2.el8.x86_64 1/2
Verifying : timedatex-0.5-3.el8.x86_64 2/2
Installed:
chrony-3.5-2.el8.x86_64 timedatex-0.5-3.el8.x86_64
Complete!
修改 /etc/chrony.conf , 改成你習慣的 ntp server
[root@example ~]# vi /etc/chrony.conf
#pool 2.centos.pool.ntp.org iburst
server time.stdtime.gov.tw iburst
重啟 chronyd 服務
[root@example ~]# systemctl restart chronyd
完成
留言列表