CentOS7时间设置与多虚拟机时间同步设置

2021-04-17  本文已影响0人  funOfFan

环境说明

agent端设置时区为上海时区

timedatectl set-ntp no
timedatectl list-timezones
timedatectl set-timezone Asia/Shanghai
timedatectl
#退出当前登录会话 
ctrl + D 
# 重新登录agent虚拟机,并查看时间是否已经修改成功
timedatectl
date

server、state端设置与agent端时间同步

yum -y install ntp ntpdate

vim /etc/ntp.conf
#编辑内容如下
restrict 127.0.0.1
restrict -6 ::1
restrict default ignore
server agent-ip
fudge agent-ip stratum 8

vi /etc/sysconfig/ntpd
OPTIONS="-g -l /var/log/ntpstats/ntpd.log"

#配置开机自启动
chkconfig ntpd on

#启动ntpd服务
service ntpd start
上一篇下一篇

猜你喜欢

热点阅读