CentOS Stream release 9使用chrony服務(wù)同步時(shí)間的操作方法
1、安裝chrony命令
Centos9里是預(yù)安裝的,沒有安裝的話執(zhí)行以下命令:
yum install -y chrony
說明:Centos9 時(shí)間同步要使用chrony命令,ntp命令不能使用了
2、查看chrony狀態(tài)
#啟用chronyd服務(wù) systemctl enable chronyd #重啟chronyd服務(wù) systemctl restart chronyd #查看chronyd服務(wù)狀態(tài) systemctl status chronyd
3、修改配置文件,將第三行注釋后添加如下內(nèi)容
vim /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.centos.pool.ntp.org iburst pool ntp1.aliyun.com iburst pool ntp2.aliyun.com iburst pool ntp3.aliyun.com iburst pool ntp4.aliyun.com iburst pool ntp5.aliyun.com iburst pool ntp6.aliyun.com iburst
4、重啟chronyd服務(wù)
systemctl restart chronyd
5、查看同步情況
通過命令進(jìn)行查看是否同步,出現(xiàn)^*即表示有可同步的源
chronyc sources MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^- 120.25.115.20 2 6 255 83 -4786us[-7195us] +/- 89ms ^* 203.107.6.88 2 6 367 26 -3585us[-5936us] +/- 97ms
System clock synchronized: yes 表示同步成功
timedatectl Local time: 一 2024-04-15 10:28:28 CST Universal time: 一 2024-04-15 02:28:28 UTC RTC time: 一 2024-04-15 02:28:29 Time zone: Asia/Shanghai (CST, +0800) System clock synchronized: yes # 表示同步成功 NTP service: active RTC in local TZ: no
6、設(shè)置時(shí)區(qū)
如果時(shí)區(qū)不對,需要執(zhí)行以下命令,修改時(shí)區(qū)
執(zhí)行如下命令修改時(shí)區(qū):
timedatectl set-timezone Asia/Shanghai
到此這篇關(guān)于CentOS Stream release 9 使用chrony服務(wù)同步時(shí)間的文章就介紹到這了,更多相關(guān)CentOS chrony服務(wù)同步時(shí)間內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
簡單的遠(yuǎn)程FTP定時(shí)備份Shell腳本分享
這篇文章主要介紹了簡單的遠(yuǎn)程FTP定時(shí)備份Shell腳本分享,,需要的朋友可以參考下2014-07-07Shell實(shí)現(xiàn)多級菜單系統(tǒng)安裝維護(hù)腳本實(shí)例分享
這篇文章主要介紹了Shell實(shí)現(xiàn)多級菜單系統(tǒng)安裝維護(hù)腳本實(shí)例分享,本文腳本用多級菜單實(shí)現(xiàn)管理WEB服務(wù)器、Mysql服務(wù)器、Nginx服器等,需要的朋友可以參考下2014-12-12CentOS中使用Shell腳本實(shí)現(xiàn)每天自動(dòng)備份網(wǎng)站文件和數(shù)據(jù)庫并上傳到FTP中
這篇文章主要介紹了CentOS中使用Shell腳本實(shí)現(xiàn)每天自動(dòng)備份網(wǎng)站文件和數(shù)據(jù)庫并上傳到FTP中,本文腳本比較實(shí)用,其它Linux系統(tǒng)也可參考,需要的朋友可以參考下2014-12-12shell 腳本中常用的內(nèi)置變量(Bash 內(nèi)置變量)
在 Bash 解釋器中,內(nèi)置了許多變量,這些變量的功能是解釋器自帶的,我們在編寫shell腳本時(shí)如果能靈活的使用它們,對腳本的編寫效率以及差錯(cuò)大有幫助, 下面一一介紹這些變量,一起看看吧2021-05-05Linux中使用Shell腳本查看Java線程的CPU使用情況
這篇文章主要介紹了Linux中使用Shell腳本查看Java線程的CPU使用情況,需要的朋友可以參考下2014-06-06awk實(shí)現(xiàn)Left、join查詢、去除重復(fù)值以及局部變量講解例子
這篇文章主要介紹了awk實(shí)現(xiàn)Left、join查詢、去除重復(fù)值以及局部變量講解例子,awk的高級使用技巧,需要的朋友可以參考下2014-07-07