1、说明
在 CentOS 8 中默认不再支持 ntp 软件包,时间同步将由 chrony 来实现。而我们的 CentOS 7 支持 ntp 和 chrony 两种设置时间同步方式。有关更多 CentOS 8 与 CentOS 7 的区别,大家可以去看一看我前面的博客《CentOS8 与 CentOS7 的区别》
2、编辑 chrony 配置文件
vim /etc/chrony.conf
1. 注释掉:
# pool 2.centos.pool.ntp.org iburst
2. 加入新的的时间服务器(可添加多个时间服务器):
server 210.72.145.44 iburst
server ntp.aliyun.com iburst
3. 如下图所示:
3、重启 chronyd 服务
systemctl restart chronyd.service
4、设置 chronyd 开机自启
systemctl enable chronyd.service
5、进行时间同步
chronyc sources -v
6、查看时间是否同步
date
以上就是 CentOS 8 设置时间同步的步骤。