1.安装ntp服务

Debian

apt-get install ntp -y

Centos

yum install ntp

2.开机启动服务

systemctl enable ntpd

3.启动服务

systemctl start ntpd

4.更改时区

timedatectl set-timezone Asia/Shanghai

5.启用ntp同步

timedatectl set-ntp yes

6.重启查看时间

reboot

查看时间

timedatectl