• Ubuntu12.10 时区设置


      升级到12.10之后,本地时间一直不对,因为之前一直在整开发环境的事情,一直没有时间去解决这个问题,如今环境配好了,该回头看看这个问题了。

    同样不懂问google,原来系统读取的bios时间默认设置为UTC时区,可是我查看了对应的/etc/default/rcS配置

    # assume that the BIOS clock is set to UTC time (recommended)
    UTC=no

    但是我在选择时间的对话框中,确实看到只有选择UTC,时间才是正确的,看来还是时区不对,于是根据网上说的方法进行时区设置:

    tzselect

    依次根据提示选择:asia->china->shanghai

    完成之后,他会有一个提示,告诉你将

    TZ='Asia/Shanghai'; export TZ

    插入到~/.profile末尾:

    
    
    cat >>~/.profile<<EOF
    TZ='Asia/Shanghai'; export TZ
    EOF
    
    

    然后将时区配置文件覆盖

     

    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

     

    ntpd设置网络自动同步:

    apt-getinstall-y ntp
    vim /etc/ntp.conf
    server 0.debian.pool.ntp.org iburst dynamic
    server 1.debian.pool.ntp.org iburst dynamic
    server 2.debian.pool.ntp.org iburst dynamic
    server 3.debian.pool.ntp.org iburst dynamic
    /etc/init.d/ntp restart

     

    然后重启下系统,看到时间能正常同步了。

    后记:

    其实在这之前的系统,我都没有进行过如上的设置,时间也能正常的同步,不解。


    参考资料:
    1http://wangyan.org/blog/debian-timezone-ntp.html
  • 相关阅读:
    linux+apache+nginx实现,反向代理动静分离
    apache编译安装php后需要注意以下配置
    nginx的gzip压缩功能
    linux+nginx+mysql+php环境下,安装ecshop
    LeetCode 328:奇偶链表 Odd Even Linked List
    LeetCode 160: 相交链表 Intersection of Two Linked Lists
    LeetCode 203:移除链表元素 Remove LinkedList Elements
    LeetCode 142:环形链表 II Linked List Cycle II
    LeetCode 141:环形链表 Linked List Cycle
    围观微博网友发起的美胸比赛学习爬取微博评论内容
  • 原文地址:https://www.cnblogs.com/xiaoyaoxia/p/2746840.html
Copyright © 2020-2023  润新知