Centos8同步时间(阿里云NTP服务为例)
1.安装所需软件包
[root@node3 ~]# yum -y install chrony
2.配置
//注释pool 2.centos.pool.ntp.org iburst
[root@node3 ~]# sed -i 's/^pool 2.centos.pool.ntp.org iburst/#&/' /etc/chrony.conf
//添加三个阿里云NTP的服务器
[root@node3 ~]# echo -e "server ntp1.aliyun.com iburst\nserver ntp2.aliyun.com iburst\nserver ntp3.aliyun.com iburst" | sudo tee -a /etc/chrony.conf
3.重启chronyd服务以应用更改
[root@node3 ~]# systemctl restart chronyd
4.设置开机自启
[root@node3 ~]# systemctl enable chronyd
5.检查是否同步成功
[root@node3 ~]# date
2023年 10月 03日 星期二 09:15:14 CST