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
# or use `tzselect` command

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 # 硬件时间使用UTC时间

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 # manually adjust the system clock.
~]# chronyc tracking # check chrony tracking.

~]# timedatectl set-ntp true