上一篇 下一篇 分享链接 返回 返回顶部

CentOS7同步时间的2种方法

发布人:小李 发布时间:2024-06-20 22:59 阅读量:2999

我们首先需要检查自身时区对不对,执行

timedatectl status|grep 'Time zone'

6180ec3a57e6f.png 

这样说明时区正确,可以继续同步时间。如果不对,可以输入 timedatectl  set-timezone Asia/Shanghai 修改

一、使用ntpdate同步时间

1.安装ntpdate

yum -y install ntpdate

2.同步时间

ntpdate -u pool.ntp.org

3.同步完成,查看时间是否正确

date

 

二、使用rdate同步时间,因为服务器禁止了所有UDP协议,所以你会发现无论如何ntpdate总是同步出错,如杭州地区。

1.安装rdate

yum -y install rdate

2.同步时间,将硬件时间调整为系统时间

rdate -s time.nist.gov

hwclock --systohc

3.查看时间是否正确

date

目录结构
全文
 

 

官方QQ群  980082857


用户服務條款

https://www.hosuyun.cn/newscontent/171.html

网站测试IP 

  https://www.hosuyun.cn/newscontent/223.html

Linux系统换yum源教程地址

https://www.baota.me/post-450.html

Centos系统开放防火墙端口

  https://www.hosuyun.cn/helpcontent/211.html

debian/utubun开放防火墙端口

  https://www.hosuyun.cn/helpcontent/212.html

 


查看详情 关闭
网站通知