无需用户输入即可更改 10.04/11.04 中的时区

Bri*_*unt 8 configuration setup date headless

如何在没有用户输入的情况下从命令行更改 Ubuntu 10.04 或 11.04 服务器中的时区(例如tzconfig EST)。

虽然有人会使用dpkg-reconfigure tzdata,但根据相关问题How to change the time-zone settings from the command line,通过用户交互,我似乎无法找到如何从非交互式脚本中更改时区。

该解决方案旨在成为配置服务器的安装脚本的一部分。

感谢您的阅读。

woj*_*jox 13

创建指向 /etc/localtime 的链接

ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
Run Code Online (Sandbox Code Playgroud)

只需将 /America/Los_Angeles 替换为您的区域即可。