时间对于任何系统至关重要,无论Linux系统,Windows系统,网络设备等。
## 日期时间
查询日期时间
```
timedatectl
```
查询时区
```
timedatectl list-timezones
timedatectl list-timezones | grep -i asia
timedatectl list-timezones | grep -i shanghai
```
设置时区
```
timedatectl set-timezone Asia/Shanghai
```
## 时间服务
查询chrony
```
yum info chrony
```
安装和配置chrony服务
```
yum install chrony -y
systemctl start chronyd
systemctl enable chronyd
systemctl status chronyd
```
配置文件/etc/chrony.conf
```
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
省略...
```