美文网首页
linux校对时间/设置时区

linux校对时间/设置时区

作者: TOPro | 来源:发表于2018-10-23 11:03 被阅读3次

设置时间,首先提升权限 sudo -i

  1. 安装工具
    # 尝试用apt-get安装,如果失败则使用yum安装
    apt-get install ntpdate || yum install ntpdate
    
  2. 执行校对
    ntpdate cn.pool.ntp.org
    # 如果出现如下错误:the NTP socket is in use, exiting,执行
    # sudo service ntp stop
    # 然后重新执行命令
    

  • 设置时区
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    

格式为 cp /usr/share/zoneinfo/$主时区/$次时区 /etc/localtime

相关文章

网友评论

      本文标题:linux校对时间/设置时区

      本文链接:https://www.haomeiwen.com/subject/lzvozftx.html