# 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
NTP
~]# yum -y install ntp | |
~]# echo "server 156.147.x.x iburst" >> /etc/ntp.conf | |
~]# systemctl enable ntpd --now | |
~]# ntpq -p | |
~]# timedatectl set-ntp true | |
~]# ntptime |