Centos 6.5 - Red Hat 6.5 时区更改

来源:互联网 发布:python开发的网站源码 编辑:程序博客网 时间:2024/06/14 15:59
tzselect
执行tzselect命令-->选择Asia-->选择China-->选择east China - Beijing, Guangdong, Shanghai, etc-->然后输入1

选择(5)Asia时区
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.
#? 5

选择国家(9)China
Please select a country.
 1) Afghanistan          18) Israel            35) Palestine
 2) Armenia          19) Japan            36) Philippines
 3) Azerbaijan          20) Jordan            37) Qatar
 4) Bahrain          21) Kazakhstan        38) Russia
 5) Bangladesh          22) Korea (North)        39) Saudi Arabia
 6) Bhutan          23) Korea (South)        40) Singapore
 7) Brunei          24) Kuwait            41) Sri Lanka
 8) Cambodia          25) Kyrgyzstan        42) Syria
 9) China          26) Laos            43) Taiwan
10) Cyprus          27) Lebanon            44) Tajikistan
11) East Timor          28) Macau            45) Thailand
12) Georgia          29) Malaysia            46) Turkmenistan
13) Hong Kong          30) Mongolia            47) United Arab Emirates
14) India          31) Myanmar (Burma)        48) Uzbekistan
15) Indonesia          32) Nepal            49) Vietnam
16) Iran          33) Oman            50) Yemen
17) Iraq          34) Pakistan
#? 9

选择(1)Shanghai当前时区
Please select one of the following time zone regions.
1) east China - Beijing, Guangdong, Shanghai, etc.
2) Heilongjiang (except Mohe), Jilin
3) central China - Sichuan, Yunnan, Guangxi, Shaanxi, Guizhou, etc.
4) most of Tibet & Xinjiang
5) west Tibet & Xinjiang
#? 1

保存(1)Yes 时区
The following information has been given:

    China
    east China - Beijing, Guangdong, Shanghai, etc.

Therefore TZ='Asia/Shanghai' will be used.
Local time is now:    Wed May  4 14:29:25 CST 2016.
Universal Time is now:    Wed May  4 06:29:25 UTC 2016.
Is the above information OK?
1) Yes
2) No
#? 1

执行完tzselect命令选择时区后,时区并没有更改,只是在命令最后提示你可以执行
TZ='Asia/Shanghai'; export TZ

修改时区配置文件
vi /etc/sysconfig/clock
ZONE="Asia/Shanghai"

链接到上海时区
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

查看时区已经更改
cat /etc/sysconfig/clock
The time zone of the system is defined by the contents of /etc/localtime.
This file is only for evaluation by system-config-date, do not rely on its
contents elsewhere.
ZONE="Asia/Shanghai"

ntp服务器联网同步

美国时间同步服务器   ntpdate time.nist.gov

中国国家授时中心       ntpdate 210.72.145.44

NTP服务器(上海)         ntpdate ntp.api.bz

复旦                                ntpdate ntp.fudan.edu.cn

微软公司授时主机(美国)   ntpdate time.windows.com

台警大授时中心(台湾)       ntpdate asia.pool.ntp.org


 如果提示报错no server suitable for synchronization found

解决方法添加-u参数可以越过防火墙与主机同步

比如 ntpdate -u 210.72.145.44


date  时间查看

重启服务器测试更改结果
reboot 或者 init6

0 0
原创粉丝点击