CentOS 7解决Local Time与实际时间相差8小时问题
时间:2015-07-12 02:31 来源:linux.it.net.cn 作者:IT
通过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(世界标准时间)不就行了嘛。
[mdrill01@mdrill03 ~]$ 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: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
[mdrill01@mdrill03 ~]$
Step 2:查看系统时区信息
[mdrill01@mdrill03 ~]$ ls /usr/share/zoneinfo/
Africa Chile GB Indian MST PRC UTC
America CST6CDT GB-Eire Iran MST7MDT PST8PDT WET
Antarctica Cuba GMT iso3166.tab Navajo right W-SU
Arctic EET GMT0 Israel NZ ROC zone.tab
Asia Egypt GMT-0 Jamaica NZ-CHAT ROK Zulu
Atlantic Eire GMT+0 Japan Pacific Singapore
Australia EST Greenwich Kwajalein Poland Turkey
Brazil EST5EDT Hongkong Libya Portugal UCT
Canada Etc HST MET posix Universal
CET Europe Iceland Mexico posixrules US
[mdrill01@mdrill03 ~]$
Step 3:删除当前系统所处时区:
[mdrill01@mdrill03 ~]$ sudo rm /etc/localtime
Step 4:从/usr/share/zoneinfo/中创建软连接以替换当前的时区信息,直接选择Universal:
[mdrill01@mdrill03 ~]$ sudo ln -s /usr/share/zoneinfo/Universal /etc/localtime
[mdrill01@mdrill03 ~]$
Step 5:利用timedatectl查看,OK问题解决。
[mdrill01@mdrill03 ~]$ 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: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
(责任编辑:IT)
通过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(世界标准时间)不就行了嘛。 [mdrill01@mdrill03 ~]$ 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: yes NTP synchronized: no RTC in local TZ: no DST active: n/a [mdrill01@mdrill03 ~]$ Step 2:查看系统时区信息 [mdrill01@mdrill03 ~]$ ls /usr/share/zoneinfo/ Africa Chile GB Indian MST PRC UTC America CST6CDT GB-Eire Iran MST7MDT PST8PDT WET Antarctica Cuba GMT iso3166.tab Navajo right W-SU Arctic EET GMT0 Israel NZ ROC zone.tab Asia Egypt GMT-0 Jamaica NZ-CHAT ROK Zulu Atlantic Eire GMT+0 Japan Pacific Singapore Australia EST Greenwich Kwajalein Poland Turkey Brazil EST5EDT Hongkong Libya Portugal UCT Canada Etc HST MET posix Universal CET Europe Iceland Mexico posixrules US [mdrill01@mdrill03 ~]$ Step 3:删除当前系统所处时区: [mdrill01@mdrill03 ~]$ sudo rm /etc/localtime Step 4:从/usr/share/zoneinfo/中创建软连接以替换当前的时区信息,直接选择Universal: [mdrill01@mdrill03 ~]$ sudo ln -s /usr/share/zoneinfo/Universal /etc/localtime [mdrill01@mdrill03 ~]$ Step 5:利用timedatectl查看,OK问题解决。 [mdrill01@mdrill03 ~]$ 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: yes NTP synchronized: no RTC in local TZ: no DST active: n/a (责任编辑:IT) |