为了在Red Hat上configuration时区,Linux机器(版本5和版本6)需要configuration文件:
/etc/sysconfig/clock
并创build一个符号链接
/etc/localtime to /usr/share/zoneinfo/America/New_York
但是/etc/sysconfig/clock也需要设置ZONEvariables,如下例所示:
ZONE="America/New_York"
那么当链接/etc/localtime指向/usr/share/zoneinfo/**America/New_York**时,需要设置variablesZONE=America/New_York 。
那么需要将ZONE参数设置为“ America/New_York ”值?
因此,设置时钟的“正确”方式(至less在RHEL 7之前)是编辑/etc/sysconfig/clock ,然后运行tzdata-update ,然后更新/etc/localtime ; 你刚刚手动完成了这一步。
随着RHEL 7的推出,时区通过systemd进行pipe理,该systemd提供了一个自定义实用程序来更改时区: timedatectl
列出所有可用的时区:
timedatectl list-timezones
要真正改变时区,(作为根或使用sudo ):
timedatectl set-timezone time_zone
timedatectl set-timezone不仅会使修改后的时区立即生效,而且还会更新/etc/localtime符号链接,以便在重新启动时保持更改持久性。