美文网首页
CentOS 7 时区设置

CentOS 7 时区设置

作者: 依然饭太稀 | 来源:发表于2018-10-09 10:01 被阅读80次

    设置时区同样, 在 CentOS 7 中, 引入了一个叫 timedatectl 的设置设置程序.

    用法很简单:

    # timedatectl # 查看系统时间方面的各种状态

    $timedatectl status

    Local time: 四2014-12-2510:52:10 CST

    Universal time: 四 2014-12-2502:52:10 UTC

    RTC time: 四 2014-12-2502:52:10Timezone: Asia/Shanghai (CST, +0800)

    NTP enabled: yes

    NTP synchronized: yes

    RTC in local TZ: no

    DST active: n/a

    # timedatectl list-timezones # 列出所有时区

    # timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间

    # timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海

    其实不考虑各个发行版的差异化, 从更底层出发的话, 修改时间时区比想象中要简单:

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

    相关文章

      网友评论

          本文标题:CentOS 7 时区设置

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