Modify NTP service and time zone
Install ntpd
yum install ntpdate
timedatetl View time Various states:
[root@localhost network-scripts]# timedatectl
Local time: Sun 2019-12-29 23:45:49 EST
Universal time: Mon 2019-12-30 04:45:49 UTC
RTC time: Mon 2019-12-30 13:49:38
Time zone: America/New_York (EST, -0500)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: no
Last DST change: DST ended at
Sun 2019-11-03 01:59:59 EDT
Sun 2019-11-03 01:00:00 EST
Next DST change: DST begins (the clock jumps one hour forward) at
Sun 2020-03-08 01:59:59 EST
Sun 2020-03-08 03:00:00 EDT
[root@localhost network-scripts]#
The state after clock synchronization is enabled is as follows:
[root@localhost ~]# timedatectl
Local time: һ 2019-12-30 13:39:32 CST
Universal time: һ 2019-12-30 05:39:32 UTC
RTC time: һ 2019-12-30 05:39:33
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
[root@localhost ~]#
timedatetl list-timezones: List all time zones
timedatetl set-local-rtc 1 adjusts the hardware clock to coincide with the local clock, 0 is set to UTC time
timedatetl set-timezone Asia/Shanghai Set the system timezone to Shanghai
calibration time
yum -y install ntp
#Calibrate time through Alibaba Cloud Time Server
Change comments to original server:
Add the following two lines:
server 192.168.32.221
restrict 192.168.32.221 nomodify notrap noquery
View synchronization status:
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
------------------------------
*192.168.32.221 120.25.115.20 3 u 83 128 377 0.109 26.318 28.265
[root@localhost ~]#
[root@localhost ~]#