CentOS 7時區設定

來源:互聯網
上載者:User

標籤:centos7 時區 timedatectl

安裝完CentOS 7過後由於各種原因需要修改或是裝置時區來同步伺服器的時間。


在CentOS 7裡面有一個命令timedatectl可以協助我們修改伺服器的時區。


首先我們可以使用timedatectl命令查看目前伺服器裡的時區設定:


      Local time: Wed 2015-07-22 16:48:14 CST

  Universal time: Wed 2015-07-22 08:48:14 UTC

        Timezone: Asia/Shanghai (CST, +0800)

     NTP enabled: yes

NTP synchronized: yes

 RTC in local TZ: yes

      DST active: n/a


可以看到目前伺服器裡的所有設定比如時間、時區、NTP等等


我們可以使用命令"timedatectl list-timezones"查看所有的時區


查看完時區後我們可以使用命令"timedatectl set-timezone 時區"


例如我們需要設定成上海的時間區:"timedatectl set-timezone Asia/Shanghai"


設定完時區後當然還可以設定NTP伺服器的開啟和關閉


開啟NTP:"timedatectl set-ntp yes"


關閉NTP:"timedatectl set-ntp no"


當然timedatectl命令還可以設定日期與時間


設定日期:"timedatectl set-time YYYY-MM-DD"


設定時間:"timedatectl set-time HH:MM:SS"

CentOS 7時區設定

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.