未知何故,服务器上的系统时间不对,比实际的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. mysql 链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES))

    mysql链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)) 修改: # ...

  2. 在Linux/Windows系统上编辑/etc/hosts文件

    Linux ubuntu16 open the terminal, input the command: sudo -i gedit /etc/hosts file click enter key, ...

  3. Spark学习(四) -- Spark作业提交

    标签(空格分隔): Spark 作业提交 先回顾一下WordCount的过程: sc.textFile("README.rd").flatMap(line => line.s ...

  4. 浏览器中的Javascript的简单对话框

    简单对话框是指对话框不去做设计,而直接使用默认的,如alert.confirm.prompt: <html> <head> <meta http-equiv=" ...

  5. CentOS搭建NodeJS环境

    事件驱动,承受高并发……这些耀眼的光环,使前端开发者不能不去学习NodeJS. 今天就在开发环境把NodeJS搭建起来了. 1. 下载node wget http://nodejs.org/dist/ ...

  6. 软件工程线上课程(C语言实践篇)学习心得总结

    林牧 + 原创作品转载请注明出处 + <软件工程(C编码实践篇)>MOOC课程http://mooc.study.163.com/course/USTC-1000002006 软件工程的理 ...

  7. 自定义UI集成微信、QQ、微博分享功能

    目前社会化分享是一个非常常见的功能,通过阅读官方文档可以进行对应平台的分享.在项目中原本有微信的分享,后来需要集成QQ和微博的分享,于是想着用ShareSDK,在使用的过程中发现ShareSDK中的w ...

  8. 在Spring里进行单元测试Junit

    搭建Spring环境(自行搭建): @RunWith注解指定使用springJunit的测试运行器 @ContextConfiguration注解指定测试用的spring配置文件的位置 import ...

  9. gulp入门教程(详细注解)

    本文转载自http://www.ydcss.com/archives/18 简介: gulp是前端开发过程中对代码进行构建的工具,是自动化项目的构建利器:她不仅能对网站资源进行优化,而且在开发过程中很 ...

  10. SPSS数据分析—对应分析

    卡方检验只能对两个分类变量之间是否存在联系进行检验,如果分类变量有多个水平的话,则无法衡量每个水平间的联系.对此,虽然可以使用逻辑回归进行建模,但是如果分类变量的水平非常多,就需要分别设定哑变量,这样 ...