linux 修改时区
一、修改时区
1、查看当前使用的时区,可以看到当前系统使用美国纽约的时区
引用
[root@hzmc ~]# date
Thu Dec 24 01:15:44 EST 2009
[root@hzmc Asia]# more /etc/sysconfig/clock
# The ZONE parameter is only evaluated by system-config-date.
# The timezone of the system is defined by the contents of /etc/localtime.
ZONE="America/New_York"
UTC=true
ARC=false
2、进入时区文件目录,可以看到很多时区文件
引用
[root@hzmc America]# ls /usr/share/zoneinfo/Asia/
Aden Bahrain Chungking Harbin Kamchatka Macau Phnom_Penh Riyadh89 Tbilisi Urumqi
Almaty Baku Colombo Hong_Kong Karachi Magadan Pontianak Saigon Tehran Vientiane
Amman Bangkok Dacca Hovd Kashgar Makassar Pyongyang Sakhalin Tel_Aviv Vladivostok
Anadyr Beirut Damascus Irkutsk Katmandu Manila Qatar Samarkand Thimbu Yakutsk
Aqtau Bishkek Dhaka Istanbul Krasnoyarsk Muscat Qyzylorda Seoul Thimphu Yekaterinburg
Aqtobe Brunei Dili Jakarta Kuala_Lumpur Nicosia Rangoon Shanghai Tokyo Yerevan
Ashgabat Calcutta Dubai Jayapura Kuching Novosibirsk Riyadh Singapore Ujung_Pandang
Ashkhabad Choibalsan Dushanbe Jerusalem Kuwait Omsk Riyadh87 Taipei Ulaanbaatar
Baghdad Chongqing Gaza Kabul Macao Oral Riyadh88 Tashkent Ulan_Bator
3、找到相应的时区文件 /usr/share/zoneinfo/Asia/Chongqing用这个文件替换当前的/etc/localtime
4、修改/etc/sysconfig/clock,将时区修改成Asia/Chongqing
引用
[root@hzmc America]# cat /etc/sysconfig/clock
# The ZONE parameter is only evaluated by system-config-date.
# The timezone of the system is defined by the contents of /etc/localtime.
ZONE="Asia/Chongqing"
UTC=true
ARC=false
5、修改时区成功
引用
[root@hzmc America]# date
Thu Dec 24 14:43:33 CST 2009
二、服务器之间同步时间
前提:两台服务器root用户配置好ssh无密码传输
引用