未知何故,服务器上的系统时间不对,比实际的UTC快了将近63分钟。在涉及本地文件与远程服务器文件的时间戳校验时,容易产生混淆。

这里把系统时间更正的过程记录如下。

参考资料:http://www.centoscn.com/CentOS/config/2015/0723/5901.html

在CentOS 7里面有一个命令timedatectl可以帮助我们修改服务器的时区。

1. 查看服务器里的时间设置  timedatectl ,它等同于  timedatectl status :

$ timedatectl
Local time: Mon -- :: CST
Universal time: Mon -- :: UTC
RTC time: Mon -- ::
Time zone: Asia/Shanghai (CST, +)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

2. 了解 timedatectl 命令的各个参数:

$ timedatectl -h
timedatectl [OPTIONS...] COMMAND ... Query or change system time and date settings. -h --help Show this help message
--version Show package version
--no-pager Do not pipe output into a pager
--no-ask-password Do not prompt for password
-H --host=[USER@]HOST Operate on remote host
-M --machine=CONTAINER Operate on local container
--adjust-system-clock Adjust system clock when changing local RTC mode Commands:
status Show current time settings
set-time TIME Set system time
set-timezone ZONE Set system time zone
list-timezones Show known time zones
set-local-rtc BOOL Control whether RTC is in local time
set-ntp BOOL Control whether NTP is enabled

3. 设置时间

$ sudo timedatectl set-time ::$ timedatectl
Local time: Mon -- :: CST
Universal time: Mon -- :: UTC
RTC time: Mon -- ::
Time zone: Asia/Shanghai (CST, +)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a

结束。

[CentOS7服务器] 更改系统时间的更多相关文章

  1. CentOS7手动修改系统时间

    CentOS7 永久修改系统时间 安装在虚拟机上的CentOS7的时间分为系统时间和硬件时间.二者都修改,重启系统(init 6 )才会永久生效.修改步骤如下 查看当前系统时间 date    修改当 ...

  2. windows bat更改系统时间 & 同步internet时间

    最近刚好用到一款软件学习版,30天试用期满,但是还想继续用,不具体透露是什么软件了. 发现更改了系统时间后,这个软件就又能启动了,不过每次改来改去很麻烦,就写了段脚本 @echo off date 1 ...

  3. Linux常用命令3--如何设置IP地址?如何更改系统时间?

    Linux常用命令 系统状态监控 [1]ps:用于显示当前系统中运行的进程. 语法:ps [-option]:常用的参数有:-a;-u;-x;-e;-f. -a:显示所有进程: -u:显示所有用户: ...

  4. Centos5, 6下更改系统时间和时区

    http://www.namhuy.net/2435/how-to-change-date-time-timezone-on-centos-6.html 查看日期(使用 -R 参数会以数字显示时区) ...

  5. Centos 更改系统时间

    .date //查看本地 .hwclock --show //查看硬件的时间 .如果硬件的时间是对不上,那就对硬件的时间进行修改 .hwclock --set --date '2222-22-22 2 ...

  6. Centos5, 6, 以及Ubuntu18.04下更改系统时间和时区

    http://www.namhuy.net/2435/how-to-change-date-time-timezone-on-centos-6.html 查看日期(使用 -R 参数会以数字显示时区) ...

  7. 基于【 centos7】二 || 系统时间与网络时间同步

    # date // 查看系统时间 #hwclock // 查看硬件时间 # yum -y install ntp ntpdate 安装ntpdate工具 # ntpdate cn.pool.ntp.o ...

  8. [Linux]Centos7/Centos6更改系统语言

    Centos7系统语言配置信息保存在/etc/locale.conf文件内 更改步骤如下: 1.使用vim打开locale.conf文件 vim /etc/locale.conf2.编辑locale. ...

  9. 2014.10.1 Cmd更改系统时间

    Process p = new Process(); //Process类有一个StartInfo属性 //设定程序名 p.StartInfo.FileName = "cmd.exe&quo ...

随机推荐

  1. Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) B

    Description Santa Claus decided to disassemble his keyboard to clean it. After he returned all the k ...

  2. 28.zookeeper单机(Standalones模式)和集群搭建笔记

    zookeeper单机(Standalones模式)和集群搭建: 前奏: (1).zookeeper也可以在windows下使用,和linux一样可以单机也可以集群,具体就是解压zookeeper-3 ...

  3. TensorFlow支持windows了

    (留坑)找个时间测试一下. 终于来了,TensorFlow 新增官方 Windows 支持

  4. ichart.js绘制虚线 ,平均分虚线

    var Data=new Array(); Data[0] = { labels : ["第一单元","第二单元","第三单元"," ...

  5. Nodejs学习总结 -Express 登录注册示例(二)

    项目创建后,我们来做个登录注册实例,详细操作步骤如下. 1.新建项目demo ,具体操作步骤参考上一章内容 https://www.cnblogs.com/Anlycp/ 2.添加mysql和sess ...

  6. img的空白符

    在div里面嵌套了一个img出来问题,div的高度超过了img的高度,大约3px ,查看了样式没什么问题,后来百度了一下,找到了2种的方法都有效: 第一种:img{display:block} 第二种 ...

  7. FFmpeg官方文档之————先进音频编码(AAC)

    先进音频编码(AAC)的后继格式到MP3,和以MPEG-4部分3(ISO / IEC 14496-3)被定义.它通常用于MP4容器格式; 对于音乐,通常使用.m4a扩展名.第二最常见的用途是在MKV( ...

  8. fiddler_技巧01

    1.选择一个包后,要点击 "Inspectors"标签页 才能有"Raw"标签页 才能看到原始的详细信息 2. 3. 4. 5.

  9. mysql连接的一些问题。

    最近网站出现 User 数据库名称 has already more than 'max_user_connections' active connections 的报错,网站瘫痪.有必要研究下这个问 ...

  10. Hibernate连数据库

    1.建数据库,建表(一定要设主码) create database Hibernate create table Students( sno char(10) primary key, sna cha ...