欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Linux?配置時(shí)間服務(wù)器的詳細(xì)過(guò)程

 更新時(shí)間:2025年03月26日 09:41:48   作者:陣雨會(huì)停.  
文章介紹了如何在Linux系統(tǒng)上配置時(shí)間服務(wù)器,包括同步阿里云服務(wù)器時(shí)間和服務(wù)端、客戶端的配置方法,以及在本地服務(wù)器上進(jìn)行時(shí)間同步的步驟,感興趣的朋友一起看看吧

一、同步阿里云服務(wù)器時(shí)間

服務(wù)端設(shè)置

1.檢查chrony服務(wù)是否安裝,設(shè)置chrony開(kāi)機(jī)自啟,查看chrony服務(wù)狀態(tài)

[root@node1-server ~]# rpm -q chrony  # rpm -q 用于查看包是否安裝
chrony-4.3-1.el9.x86_64
[root@node1-server ~]# systemctl enable --now chronyd  # 設(shè)置服務(wù)開(kāi)機(jī)自啟
[root@node1-server ~]# systemctl status chronyd  # 查看chronyd服務(wù)狀態(tài)
● chronyd.service - NTP client/server
     Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; preset: enabled)
     Active: active (running) since Tue 2025-03-25 14:11:34 CST; 2h 22min ago
       Docs: man:chronyd(8)
             man:chrony.conf(5)
   Main PID: 905 (chronyd)
      Tasks: 1 (limit: 10681)
     Memory: 4.0M
        CPU: 80ms
     CGroup: /system.slice/chronyd.service
             └─905 /usr/sbin/chronyd -F 2

2.關(guān)閉防火墻,SELinux設(shè)置為寬容模式,查看防火墻狀態(tài)

[root@node1-server ~]# systemctl stop firewalld && systemctl disable firewalld  # 關(guān)閉防火墻服務(wù),關(guān)閉成功后禁用服務(wù)
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".
[root@node1-server ~]# setenforce 0  # SELinux 調(diào)整為寬容模式
[root@node1-server ~]# getenforce  # 查看 SELinux 狀態(tài)
Permissive  # 寬容模式
[root@node1-server ~]# systemctl status firewalld.service  # 查看防火墻狀態(tài)
○ firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:firewalld(1)

3.編輯服務(wù)端/etc/chrony.conf文件

[root@node1-server ~]# vim /etc/chrony.conf
  3 #pool 2.rhel.pool.ntp.org iburst  # 注釋此行
  4 pool ntp.aliyun.com iburst  # pool 是一個(gè)關(guān)鍵字,作用是指定一組 NTP 服務(wù)器,iburst表示的是首次同步的時(shí)候快速同步
  27 #allow 192.168.0.0/16  # 注釋此行
  28 allow 192.168.11.0/24  # 允許同步該網(wǎng)段

4.重啟服務(wù),查看服務(wù),查看日期

[root@node1-server ~]# systemctl restart chronyd  # 重啟服務(wù)
[root@node1-server ~]# chronyc sources -v  # 查看服務(wù)
  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
=========================================================================
^* 203.107.6.88                  2   6    17    25    +20ms[  +30ms] +/-   72ms
[root@node1-server ~]# date  # 查看日期
Tue Mar 25 04:54:42 PM CST 2025   # 與阿里云服務(wù)器同步成功

客戶端設(shè)置

1.關(guān)閉防火墻并查看防火墻狀態(tài)

[root@node2-client ~]# systemctl stop firewalld.service && systemctl disable firewalld.service  #關(guān)閉防火墻
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".
[root@node2-client ~]# systemctl status firewalld.service  #查看防火墻狀態(tài)
○ firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:firewalld(1)

2.編輯客戶端配置文件

[root@node2-client ~]# vim /etc/chrony.conf
  3 #pool 2.rhel.pool.ntp.org iburst
  4 pool 192.168.11.135 iburst  # 以192.168.11.135為時(shí)間服務(wù)器

3.客戶端重啟服務(wù),查看服務(wù),查看日期

[root@node2-client ~]# systemctl restart chronyd  # 重啟服務(wù)
[root@node2-client ~]# chronyc sources -v  # 查看服務(wù)
  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
=========================================================================
^* 192.168.11.135                3   6    17     8    +30us[  +80us] +/-   54ms
[root@node2-client ~]# date  # 查看日期
Tue Mar 25 04:59:27 PM CST 2025   #與服務(wù)端同步成功

二、同步本地服務(wù)器時(shí)間

服務(wù)端配置

1.修改服務(wù)端配置文件

[root@node1-server ~]# vim /etc/chrony.conf 
 30 # Serve time even if not synchronized to a time source.
 31 local stratum 10  # 把本地系統(tǒng)設(shè)置為一個(gè) NTP 時(shí)間源,并且將其 Stratum 層級(jí)設(shè)定為 10

2.修改 /etc/resolv.conf 文件,不使用dns解析,模擬無(wú)法上網(wǎng)的情況

[root@node1-server ~]# vim /etc/resolv.conf
# Generated by NetworkManager
#nameserver 223.5.5.5  # 注釋此行

3.修改錯(cuò)誤時(shí)間

[root@node1-server ~]# date -s '2021-12-13 14:54:58'  # 修改時(shí)間是為了讓結(jié)果更明顯
Mon Dec 13 02:54:58 PM CST 2021

4.重啟服務(wù),查看服務(wù),查看日期

[root@node1-server ~]# systemctl restart chronyd
[root@node1-server ~]# chronyc sources -v
  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
=========================================================================
[root@node1-server ~]#   # 此處能看到?jīng)]有時(shí)間服務(wù)器與本機(jī)同步
[root@node1-server ~]# date
Mon Dec 13 02:56:42 PM CST 2021

客戶端配置 僅需客戶端重啟服務(wù),查看服務(wù),查看日期

[root@node2-client ~]# systemctl restart chronyd
[root@node2-client ~]# chronyc sources -v
  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
=========================================================================
^* 192.168.11.135               10   6    17     8  +7530ns[+8920ns] +/-  150us
[root@node2-client ~]# date
Mon Dec 13 02:58:41 PM CST 2021   # 時(shí)間與服務(wù)端同步成功

到此這篇關(guān)于Linux 配置時(shí)間服務(wù)器的文章就介紹到這了,更多相關(guān)Linux 時(shí)間服務(wù)器內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Linux C字符串替換函數(shù)實(shí)例詳解

    Linux C字符串替換函數(shù)實(shí)例詳解

    這篇文章主要介紹了Linux C字符串替換函數(shù)實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下
    2017-01-01
  • VScode Remote SSH通過(guò)遠(yuǎn)程編輯與調(diào)試代碼

    VScode Remote SSH通過(guò)遠(yuǎn)程編輯與調(diào)試代碼

    這篇文章主要介紹了VScode Remote SSH通過(guò)遠(yuǎn)程編輯與調(diào)試代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-05-05
  • linux的基本命令mkdir使用詳解

    linux的基本命令mkdir使用詳解

    這篇文章主要介紹了linux的基本命令mkdir使用詳解的相關(guān)資料,需要的朋友可以參考下
    2023-03-03
  • 深入理解linux執(zhí)行文件提示No such file or directory的背后原因

    深入理解linux執(zhí)行文件提示No such file or directory的背后原因

    這篇文章主要介紹了深入理解linux執(zhí)行文件提示No such file or directory的背后原因,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-12-12
  • Linux下的chkconfig命令詳解

    Linux下的chkconfig命令詳解

    大家都知道chkconfig命令在linux中使用是非常的關(guān)鍵的,我們可以利用chkconfig來(lái)對(duì)系統(tǒng)的一些啟動(dòng)與禁止相關(guān)設(shè)置,下面這篇文章小編就來(lái)給大家詳細(xì)的介紹Linux下的chkconfig命令用法,有需要的朋友們可以參考學(xué)習(xí),下面來(lái)一起看看吧。
    2016-11-11
  • Linux環(huán)境下使用glog日志庫(kù)的方法

    Linux環(huán)境下使用glog日志庫(kù)的方法

    今天小編就為大家分享一篇關(guān)于Linux環(huán)境下使用glog日志庫(kù)的方法,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
    2018-12-12
  • 詳解apache配置域名的坑

    詳解apache配置域名的坑

    這篇文章主要介紹了詳解apache配置域名的坑,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-02-02
  • linux修改文件所屬用戶和組的實(shí)例方法

    linux修改文件所屬用戶和組的實(shí)例方法

    在本篇文章里小編給大家整理的是一篇關(guān)于linux修改文件所屬用戶和組的實(shí)例方法,對(duì)此有興趣的朋友們可以跟著學(xué)習(xí)下。
    2021-12-12
  • Windows下 Apache PHP 環(huán)境搭建的方法

    Windows下 Apache PHP 環(huán)境搭建的方法

    經(jīng)常在 Linux 環(huán)境下搭建 php 環(huán)境,在 windows 下還是第一次,沒(méi)啥技術(shù)含量,就是記錄一下,需要的朋友參考下本教程
    2017-01-01
  • 干貨 | Linux新手入門(mén)好書(shū)推薦

    干貨 | Linux新手入門(mén)好書(shū)推薦

    今天在知乎上看到了這樣一個(gè)問(wèn)答:學(xué)習(xí)操作系統(tǒng)的知識(shí),看哪本書(shū)好?讀完之后,我決定理一下操作系統(tǒng)方面的好書(shū)推薦給需要學(xué)習(xí)這個(gè)方向知識(shí)的人。下面這篇文章主要給Linux新手們推薦了一些入門(mén)的好書(shū),需要的朋友可以參考下。
    2017-10-10

最新評(píng)論