美文网首页树莓派个人收藏
树莓派的系统时间校对问题

树莓派的系统时间校对问题

作者: LienZzzz | 来源:发表于2016-05-28 00:15 被阅读4549次

    前言

    最近开始捡起来闲了两年多的树莓派,使用的过程中发现了系统时间还是14年的,查阅了相关资料后,折腾了一下后解决了。

    树莓派本身还是要依靠ntp同步时间,网上的教程很多,安装好后设置时区后,我的问题依然没法解决。

    后来看到个帖子是调整服务器,跟着做了后没什么用,好在有前人说了调整服务器的思路是对的,但是服务器的地址都不好用,后来改了用Mac的地址,也终于解决了。果然是如此。

    过程

    过程简要记录下吧:

    安装源

    树莓派自带的源速度略慢,后来换了阿里的源

    sudo vim /etc/apt/sources.list
    

    备份后,在最前面加入阿里云的源

    deb http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
    deb-src http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
    

    更新源和软件

    sudo apt-get update
    sudo apt-get upgrade
    

    安装并设置ntp

    安装ntp,可先看看树莓派有无安装

    sudo apt-get install ntpdate
    

    设置时区

    tzselect
    

    最重要的一步,调整ntp服务器

    sudo vim /etc/ntpd.conf
    

    找到这两行

    # You do need to talk to an NTP server or two (or three).
    # server ntp.your-provider.example
    

    填Mac一样的ntp服务器

    server time.apple.com iburst
    

    重启ntp即可

    sudo service ntp restart
    

    附录

    对此文有帮助;
    树莓派ntp时间同步问题
    用树莓派搭建网络摄像头

    相关文章

      网友评论

        本文标题:树莓派的系统时间校对问题

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