CentOS7更改時區
用timedatectl命令查看當前服務器時區設置:
Local time: Mon 2017-03-27 20:14:15 CST Universal time: Mon 2017-03-27 12:14:15 UTC RTC time: Mon 2017-03-27 12:14:15 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a
查看所有時區timedatectl list-timezones
更改成上海時區timedatectl set-timezone Asia/Shanghai
設置NTP開啟timedatectl set-ntp yes
設置NTP關閉timedatectl set-ntp no
timedatectl命令也可以設置時間和日期
設置日期格式timedatectl set-time YYYY-MM-DD
設置時間格式timedatectl set-time HH:MM:SS
同步阿裏雲時間服務器/usr/sbin/ntpdate ntp1.aliyun.com
最後更新:2017-06-30 09:32:06