CentOS 7更新系统时间

Linux系统在安装的时候,总是会出现时区,时间的错误。

Linux系统时间和本地区网络时间同步,ntpdate可以从网络同步时间,

需要安装sudo yum install ntp ntpdate,设置开机自启sudo systemctl start ntpdsudo systemctl enable ntpd

ntp只能同步时间,使用timedatectl设置时区,timedatectl命令在systemd包中,默认安装。

timedatectl可以查看时间和时区,timedatectl list-timezones查看所有的时区,timedatectl set-zone Asia/Shanghai设置时区为上海,执行ntpdate同步Asia/Shanghai的时间。

原文地址:https://www.cnblogs.com/zzhaolei/p/11067834.html