## 1、开启关闭ntp
ntp可以自动同步网络时间。
## 2、更改时间
更改硬件时间
```bash
hwclock --set --date="2022-01-01 00:00:00"
```
更改系统时间
```bash
date -s "2020-02-02 00:00:00"
```
更改系统时区
```bash
#默认没有设置过的为 UTC 时间,一般都需要改为北京时间
#先查看当前时区配置
timedatectl status
Local time: Tue 2022-03-29 10:41:46 UTC
Universal time: Tue 2022-03-29 10:41:46 UTC
RTC time: Tue 2022-03-29 10:41:46
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
#这个是 UTC 时间设置,现在改一下
#选择时区
tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa
2) Americas
3) Antarctica
4) Asia
5) Atlantic Ocean
6) Australia
7) Europe
8) Indian Ocean
9) Pacific Ocean
10) coord - I want to use geographical coordinates.
11) TZ - I want to specify the time zone using the Posix TZ format.
依次输入4 (Asia), 10(China), 1(Beijing), 1(yes)
#复制文件到/etc目录下
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#重启完成
```