> CentOS > CentOS运维 >

centos 7修改系统时间

1.查看时间

[root@itnetcn ~]# date 

Wed May 30 22:24:35 EDT 2018   #和显示时间有误差

2.同步网络服务器时间

[root@itnetcn ~]# ntpdate 218.186.3.36

3.使用tzselect

[root@itnetcn ~]# tzselect 

选择5) Asia -->  9) China  ----> 1) Beijing Time 

Therefore TZ='Asia/Shanghai' will be used.
Local time is now: Thu May 31 10:24:21 CST 2018.
Universal Time is now: Thu May 31 02:24:21 UTC 2018.
Is the above information OK?
1) Yes
2) No

#? 1  #选择1.是

4. 修改配置文件

[root@itnetcn ~]# mv /etc/localtime{,.bak}

[root@itnetcn ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

5.查看

[root@itnetcn ~]# ntpdate cn.ntp.org.cn
31 May 10:08:23 ntpdate[54206]: adjust time server 223.113.97.99 offset 0.002774 sec

[root@itnetcn ~]# date
Thu May 31 09:46:20 CST 2018



(责任编辑:IT)