安装ntp和ntpdate
在安装centos7虚拟机的时候,已经将时区设置为了Asia/shanghai,但还是出现时间不准,相差了8小时
可以安装ntp和ntpdate,使用 NTP 公共时间服务器池(NTP Public Pool Time Servers)http://www.pool.ntp.org 同步你的服务器时间。
安装步骤
- 安装:sudo yum install ntpdate ntp -y
- 允许服务:sudo systemctl enable ntpd && sudo systemctl enable ntpdate
- 开启服务:sudo systemctl start ntpdate && sudo systemctl start ntpd