Linux - 運維篇
系列文章回顧
第一章 Linux擴容LVM分區(qū)
第二章 Linux虛擬機安裝VMware Tools插件
第三章 ssh-keygen和openssl工具的使用
下章內(nèi)容
第五章 Linux facl擴展權(quán)限的用法
Linux配置NTP時間同步
僅實驗CentOS 7.X
系列的Linux
操作系統(tǒng)
[root@localhost ~]# yum install ntp -y # 安裝ntp服務
# 配置ntp時間從X.X.X.X同步
[root@localhost ~]# vim /etc/ntp.conf
... # 注釋掉其他server,僅保留一條server配置
server X.X.X.X iburst
:x
# 配置HWCLOCK硬件層的ntp時間同步
[root@localhost ~]# vim /etc/sysconfig/ntpd
# Command line options for ntpd
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g"
SYNC_HWCLOCK=yes
:x
[root@localhost ~]# systemctl enable --now ntpd # 添加ntpd (ntp deamon) 服務的開機自啟
[root@localhost ~]# systemctl restart ntpd # 重啟ntpd服務
[root@localhost ~]# ntpstat # 查看ntp的status狀態(tài)
[root@localhost ~]# ntpq -p # 打印remote主機ntp狀態(tài)
[root@localhost ~]# ntpdate -u x.x.x.x # 主動與目標主機建立ntp連接
Linux配置CST時區(qū)
timedatectl
工具配置CST
時區(qū)
[root@localhost ~]# timedatectl list-timezones # 查看可配置的時區(qū)列表
[root@localhost ~]# timedatectl list-timezones | grep Shanghai # 僅查看上海時區(qū)
[root@localhost ~]# timedatectl set-timezone Asia/Shanghai # set-timezone選項更改時區(qū)
驗證文章來源:http://www.zghlxwxcb.cn/news/detail-616917.html
# CentOS 7.X 系列查看當前時區(qū)配置
[root@localhost ~]# timedatectl
Local time: Xxx 2023-0X-XX 08:00:00 CST
Universal time: Xxx 2023-0X-XX 00:00:00 UTC
RTC time: Xxx 2023-0X-XX 00:00:00
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
[root@localhost ~]# date
Xxx Xxx XX 00:00:00 CST 2023
參考來源
無文章來源地址http://www.zghlxwxcb.cn/news/detail-616917.html
到了這里,關于[個人筆記] Linux配置NTP時間同步的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!