### centos7 时间同步

#### 1. 安装 ntpdate

```bash
yum install ntp -y
```

#### 2. 同步阿里云时间

```bash
ntpdate ntp3.aliyun.com
```

#### 3. 定时同步

- 10分钟同步一次

```bash
0-59/10 * * * * /usr/sbin/ntpdate ntp3.aliyun.com
```

### centos8 时间同步

```bash
yum install -y chrony
systemctl enable chronyd --now
mv /etc/chrony.conf /etc/chrony.conf.bak
cat >> /etc/chrony.conf  << EOF
server ntp.aliyun.com iburst
server cn.ntp.org.cn iburst
EOF
systemctl restart chronyd.service
chronyc  sources -v
```