CentOS 7解決Local Time與實際時間相差8小時問題

來源:互聯網
上載者:User

標籤:style   blog   http   ar   color   os   sp   on   div   

通過date -s “2014-12-06 15:00:00”以及timedatectl set-time “2014-12-06 15:00:00” ,以及ntp等方式均知識臨時有效,苦惱了我半天。廢話少說,直奔主題。

Step 1:查看時間發現Local time不對,而Universal time是正確的。那麼將本地時間設定為:UTC(世界標準時間)不就行了嘛。

[[email protected] ~]$ timedatectl       Local time: Sat 2014-12-06 22:59:33 CST    #活生生的多了8個小時  Universal time: Sat 2014-12-06 14:59:33 UTC        Timezone: Asia/Shanghai (CST, +0800)     NTP enabled: yesNTP synchronized: no RTC in local TZ: no      DST active: n/a[[email protected] ~]$ 

Step 2:查看系統時區資訊

[[email protected] ~]$ ls /usr/share/zoneinfo/Africa      Chile    GB         Indian       MST         PRC        UTCAmerica     CST6CDT  GB-Eire    Iran         MST7MDT     PST8PDT    WETAntarctica  Cuba     GMT        iso3166.tab  Navajo      right      W-SUArctic      EET      GMT0       Israel       NZ          ROC        zone.tabAsia        Egypt    GMT-0      Jamaica      NZ-CHAT     ROK        ZuluAtlantic    Eire     GMT+0      Japan        Pacific     SingaporeAustralia   EST      Greenwich  Kwajalein    Poland      TurkeyBrazil      EST5EDT  Hongkong   Libya        Portugal    UCTCanada      Etc      HST        MET          posix       UniversalCET         Europe   Iceland    Mexico       posixrules  US[[email protected] ~]$ 

Step 3:刪除當前系統所處時區:

[[email protected] ~]$ sudo rm /etc/localtime 

Step 4:從/usr/share/zoneinfo/中建立軟串連以替換當前的時區資訊,直接選擇Universal:

[[email protected] ~]$ sudo ln -s /usr/share/zoneinfo/Universal /etc/localtime[[email protected] ~]$ 

Step 5:利用timedatectl查看,OK問題解決。

[[email protected] ~]$ sudo timedatectl       Local time: Sat 2014-12-06 15:10:39 UTC  Universal time: Sat 2014-12-06 15:10:39 UTC        RTC time: Sat 2014-12-06 07:11:04        Timezone: Universal (UTC, +0000)     NTP enabled: yesNTP synchronized: no RTC in local TZ: no      DST active: n/a

備忘:CentOS Linux: Setting timezone and synchronizing time with NTP

 

CentOS 7解決Local Time與實際時間相差8小時問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.