dan*_*dan 8 linux redhat timezone clock-synchronization date
为了在 red hat Linux 机器(版本 5 和 6)上配置时区需要配置文件:
/etc/sysconfig/clock
Run Code Online (Sandbox Code Playgroud)
并在它们之间创建符号链接
/etc/localtime to /usr/share/zoneinfo/America/New_York
Run Code Online (Sandbox Code Playgroud)
但/etc/sysconfig/clock
还需要将ZONE
变量设置为以下示例:
ZONE="America/New_York"
Run Code Online (Sandbox Code Playgroud)
那么,什么是需要设置的变量ZONE=America/New_York
时,它是从链路很清楚/etc/localtime
的是指向/usr/share/zoneinfo/**America/New_York**
?
那么有什么需要ZONE
用“ America/New_York
”值来设置参数呢?
随着 RHEL 7 的引入,时区通过 systemd 进行管理,它提供了一个自定义实用程序来更改时区: timedatectl
列出所有可用的时区:
timedatectl list-timezones
Run Code Online (Sandbox Code Playgroud)
要实际更改时区,(以 root 身份或使用sudo
):
timedatectl set-timezone time_zone
Run Code Online (Sandbox Code Playgroud)
timedatectl set-timezone
不仅会使修改后的时区立即生效,还会更新/etc/localtime
符号链接以使该更改在重新启动后保持不变。
因此,设置时钟的“正确”方法(至少在 RHEL 7 之前)是编辑/etc/sysconfig/clock
然后运行tzdata-update
,然后更新/etc/localtime
;您刚刚手动完成了该步骤。