###前言
装完docker发现容器里面时间与系统时间不一致,于是就想把UTC转换成CST,谁让这个UTC的时间比北京时间晚8个小时呢!
###简单介绍
UTC 世界协调时间 (United Technology Corporation)
北京早上8点(东八区),UTC的时间为零点
CST 中国沿海时间(北京时间)(China Standard Time)
### 查看当前时间
[root@localhost ~]# date -R
Wed, 17 Oct 2018 16:44:50 +0800
[root@localhost ~]# date
Wed Oct 17 07:06:16 UTC 2018
### 设置时区
[root@localhost ~]# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.
#?
…………
### 修改localtime
[root@localhost ~]# mv /etc/localtime /etc/localtime_bak
[root@localhost ~]# cp -af /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
### 链接localtime
[root@localhost ~]# mv /etc/localtime /etc/localtime_bak
[root@localhost ~]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
### 修改clock
[root@localhost ~]# mv /etc/sysconfig/clock /etc/sysconfig/clockbak
[root@localhost ~]# vim /etc/sysconfig/clock
ZONE="Asia/Shanghai"
UTC=true 修改为 UTC=false
以上方法对我统统没用 m9( `д´ )!!!!,生气
所以我只好把别的服务器的Shanghai拷过来,替换到/etc/localtime,成功。ପ( ˘ᵕ˘ ) ੭ ☆