码迷,mamicode.com
首页 > 其他好文 > 详细

centos修改时区同步时间

时间:2018-12-07 20:59:15      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:sha   编辑   app   php   保存   服务器时间   时间   cal   this   

查看服务器时间及所在时区

[root@localhost ~]# date -R
Fri, 07 Dec 2018 04:38:28 -0500

修改时区

先使用 tzselect 根据提示选择所在地区,最终生成时区

You can make this change permanent for yourself by appending the line
    TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

然后编辑 /etc/profile 文件,添加 TZ=‘Asia/Shanghai‘; export TZ,编辑完成后保存,运行 source /etc/profile

再次使用 date -R 查看时间

Fri, 07 Dec 2018 17:42:28 +0800

同步时间

安装 ntpdate

[root@localhost ~]# yum install ntpdate -y

前往 http://www.ntp.org.cn 查询可用的NTP服务,同步时间

[root@localhost ~]# ntpdate cn.ntp.org.cn

如同步出现错误 no server suitable for synchronization found,可尝试使用 ntpdate -u cn.ntp.org.cn同步

centos修改时区同步时间

标签:sha   编辑   app   php   保存   服务器时间   时间   cal   this   

原文地址:https://www.cnblogs.com/wenhui92/p/10084269.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!