linux服务器版如何更新系统时间,如何更新linux服务器的系统时间

由于服务器的时间出现错误,可采用以下方法来更新linux服务器的系统时间:

方法一:

1,首先yum 安装本地ntpdate客户端,更新ntpdate cn.pool.ntp.org时使用

[root@localhost ~]# yum install ntpdate

2,使用ntpdate cn.pool.ntp.org进行更新。

[root@localhost ~]# ntpdate cn.pool.ntp.org

15 Sep 16:46:32 ntpdate[15965]: adjust time server 202.112.29.82 offset 0.010499 sec

或者使用cn.pool.ntp.org 的ip地址进行更新。

[root@localhost ~]# ping cn.pool.ntp.org

PING cn.pool.ntp.org (202.112.10.36) 56(84) bytes of data.

64 bytes from gus.buptnet.edu.cn (202.112.10.36): icmp_seq=1 ttl=44 time=107 ms

64 bytes from gus.buptnet.edu.cn (202.112.10.36): icmp_seq=2 ttl=44 time=86.2 ms

ntpdate

[root@localhost ~]# ping cn.pool.ntp.org

PING cn.pool.ntp.org (202.112.10.36) 56(84) bytes of data.

64 bytes from gus.buptnet.edu.cn (202.112.10.36): icmp_seq=1 ttl=44 time=107 ms

64 bytes from gus.buptnet.edu.cn (202.112.10.36): icmp_seq=2 ttl=44 time=86.2 ms

[root@localhost ~]# ntpdate 202.112.10.36

15 Sep 16:49:14 ntpdate[15966]: adjust time server 202.112.10.36 offset 0.010657 sec

3,更新完后要用 clock -w 或 hwclock -w 实时间写入到BIOS中,这样下次启动时,时间就会自动更新了。

[root@localhost ~]# clock -w

方法二:

直接使用命令进行更新,ntpdate time-a.nist.gov

[root@localhost ~]#  ntpdate time-a.nist.gov

备注:常用的命令:

date           #显示当前时间,这个是系统时间

clock          #显示硬件时间

hwclock        #硬件时间

hwclock -w     #将系统时钟写到硬件时钟

hwclock -s     #将硬件时钟写到系统时钟

互联网常用的ntp时间同步站点:

time-a.nist.gov

time.windows.com

time.nist.gov

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值