安装NTP服务
yum install ntp
配置ntp
vim /etc/ntp.conf
修改ntp服务器ip
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 10.163.145.41 iburst
重启ntp服务
[root@localhost app]# systemctl stop ntpd
[root@localhost app]# systemctl start ntpd
[root@localhost app]# systemctl status ntpd
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
Active: active (running) since 四 2023-09-14 10:52:00 CST; 2s ago
Process: 10033 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 10035 (ntpd)
Tasks: 1
CGroup: /system.slice/ntpd.service
└─10035 /usr/sbin/ntpd -u ntp:ntp -g