您的位置首页生活百科

通过NTP服务器实现时间同步

通过NTP服务器实现时间同步

的有关信息介绍如下:

通过NTP服务器实现时间同步

通过NTP同步时间

安装ntp,yum install ntp

Date 发现格式为EDT,我们需要修改为CST格式

[root@test ~]# mv /etc/localtime /etc/localtime.bak

[root@test ~]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

[root@test ~]# date

并用ntpdate 208.91.112.50,同步网上的一台ntp服务器同步时间

vi/etc/ntp.conf,修改配置文件,使能同步网上的ntp服务器

我们这里使用的是centos7不同于以往linux的操作,对于开机自启动的调整,命令有所不同。 chkconfig --list查看非系统内置服务的自启动状态

systemctl enable ntpd.service //开机自启动

ntpq –p

*表示目前使用的ntp server的状态

Ntpstat,可以看到已经同步了

显示所有已启动的服务 systemctl list-units --type=service