CentOS7 NTP(Network Time Protocol) 时间同步配置

1、查看是否已经安装好ntp服务

[root@rhino130]# rpm -qa|grep ntp

如果显示已安装则直接进行第二步操作,否则先进行ntp服务的安装;执行以下yum安装即可:

[root@rhino130]# yum install ntp ntpdate -y

2、修改ntp.conf配置文件

[root@rhino130]# vim /etc/ntp.conf

1)注释如下语句

#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst

2)在注释语句下方添加要同步的时间服务器IP地址

server 192.168.3.67 //ntp服务端机器地址

3、重启ntp服务,手动同步时间

systemctl restart ntpd

ntpdate -u 192.168.3.67

查看状态

[root@mimc-es1~]# ntpq -p

4、写入硬件时间

hwclock -w

posted @ 2022-09-16 13:16  操作工  阅读(382)  评论(0)    收藏  举报