Configuring NTP or Chrony time synchronization on RHEL
Windows: 将硬件时间(RTC time)识别为本地时间(Local time),进行时间同步。
Linux: 将硬件时间(RTC time)识别为 UTC 时间,则本地时间(Local time)=UTC 时间 + 时区,进行时间同步。
Manually
RHEL 6:
ls -la /etc/localtime rm -f /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date -s "20250724 14:30:00"
|
RHEL 7:
timedatectl list-timezones timedatectl set-timezone Asia/Shanghai timedatectl set-ntp false timedatectl set-time "2026-02-09 13:50:43" timedatectl status
|
RTC time:
hwclock --show
hwclock --systohc hwclock --hctosys
timedatectl set-local-rtc 0 timedatectl set-local-rtc 1
|
Configuring NTP Synchronization
~]# yum -y install ntp ~]# echo "server 156.147.135.170 iburst" >> /etc/ntp.conf
~]# systemctl enable ntpd --now ~]# ntpq -p
~]# timedatectl set-ntp true
|
~]# yum -y install chrony ~]# sed -i 's/^server/#server/g' /etc/chrony.conf ~]# echo "server 156.147.135.170 iburst" >> /etc/chrony.conf
~]# systemctl restart chronyd ~]# systemctl enable chronyd ~]# chronyc sources -v
~]# chronyc makestep ~]# chronyc tracking
~]# timedatectl set-ntp true
|