zoukankan      html  css  js  c++  java
  • centos修改时区并同步时间

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

    [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,可尝试使用

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

    或者将域名改为ip

  • 相关阅读:
    盛大自动化运维
    Redis used_cpu_sys used_cpu_user meaning (redis info中cpu信息的含义)
    redis info 详解
    htop详解
    线程问题排查思路
    网络协议基础 -- 东哥
    线程通讯
    进程
    day14
    day13
  • 原文地址:https://www.cnblogs.com/wenhui92/p/10084269.html
Copyright © 2011-2022 走看看