centos7修改系统时间

1.查看时间

[root@4haocentos ~]# date 

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

2.同步网络服务器时间

[root@4haocentos ~]# ntpdate 218.186.3.36

3.使用tzselect

[root@4haocentos ~]# 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@4haocentos ~]# mv /etc/localtime{,.bak}

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

5.查看

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

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

猜你喜欢

转载自blog.csdn.net/wanchaopeng/article/details/80825233
今日推荐