timedatectl 是 RHEL7 上的一项新功能。它可用于查询和更改系统时钟及其设置。

按照以下步骤将时区更改为中国。(以root用户身份执行以下命令)。

1.使用以下命令列出所有可用的时区。你将使用此命令获得一长串时区。

# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
....

2.找到中国时区中所需的正确时区并设置特定时区。有一个名为 tzselect 的命令可以帮助您找到所需的时区。例如,要在中国查找时区,请按如下所示使用它:

# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
) Africa
) Americas
) Antarctica
) Arctic Ocean
) Asia
) Atlantic Ocean
) Australia
) Europe
) Indian Ocean
) Pacific Ocean
) none - I want to specify the time zone using the Posix TZ format.
#?
Please select a country.
) Afghanistan ) Israel ) Palestine
) Armenia ) Japan ) Philippines
) Azerbaijan ) Jordan ) Qatar
) Bahrain ) Kazakhstan ) Russia
) Bangladesh ) Korea (North) ) Saudi Arabia
) Bhutan ) Korea (South) ) Singapore
) Brunei ) Kuwait ) Sri Lanka
) Cambodia ) Kyrgyzstan ) Syria
) China ) Laos ) Taiwan
) Cyprus ) Lebanon ) Tajikistan
) East Timor ) Macau ) Thailand
) Georgia ) Malaysia ) Turkmenistan
) Hong Kong ) Mongolia ) United Arab Emirates
) India ) Myanmar (Burma) ) Uzbekistan
) Indonesia ) Nepal ) Vietnam
) Iran ) Oman ) Yemen
) Iraq ) Pakistan
#?

Please select one of the following time zone regions.
  1) Beijing Time
  2) Xinjiang Time
  #? 1


The following information has been given:


China
  Beijing Time


Therefore TZ='Asia/Shanghai' will be used.
  Local time is now: Thu Aug 22 16:57:30 CST 2019.
  Universal Time is now: Thu Aug 22 08:57:30 UTC 2019.
  Is the above information OK?
  1) Yes
  2) No
  #? 1


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.


Here is that TZ value again, this time on standard output so that you
  can use the /usr/bin/tzselect command in shell scripts:
  Asia/Shanghai

 
# timedatectl set-timezone Asia/Kolkata

3. 运行 “date” 命令查看时间是否正确

# date
Thu Aug :: CST

您还可以使用 timedatectl status 命令检查详细状态。

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

CentOS / RHEL 7 更改时区的更多相关文章

  1. [转帖]如何重置CentOS/RHEL 7中遗忘的根用户帐户密码

    如何重置CentOS/RHEL 7中遗忘的根用户帐户密码 https://www.cnblogs.com/swordxia/p/4389466.html 作者的blog质量很高呢 没看完 但是感觉 很 ...

  2. Linux 更改时区

    原文:https://www.cnblogs.com/st-jun/p/7737188.html Linux修改时区的正确方法 CentOS和Ubuntu的时区文件是/etc/localtime,但是 ...

  3. 【Linux笔记】CentOS&RHEL YUM基础知识

    以下内容收集自网络,以作参考. 一.YUM是什么 YUM = Yellow dog Updater, Modified. 主要功能是更方便的添加/删除/更新RPM包. 它能自动解决包的倚赖性问题. 它 ...

  4. 【Linux】YUM Repositories for CentOS, RHEL & Fedora Systems

    这里是官方wiki:https://wiki.centos.org/AdditionalResources/Repositories 一.简介 YUM(Yellowdog Updater Modifi ...

  5. 如何在CentOS/RHEL & Fedora上安装MongoDB 3.2

    MongoDB(名称取自"huMONGOus")是一个有着全面灵活的索引支持和丰富的查询的数据库.MongoDB通过GridFS提供强大的媒体存储.点击这里获取MongoDB的更多 ...

  6. PHP 5.4 on CentOS/RHEL 6.4 and 5.9 via Yum

    PHP 5.4 on CentOS/RHEL 6.4 and 5.9 via Yum PHP 5.4.16 has been released on PHP.net on 6th June 2013, ...

  7. [转载]PHP 5.6 on CentOS/RHEL 7.0 and 6.6 via Yum

    https://webtatic.com/packages/php56/ PHP 5.6.5 has been released on PHP.net on 22nd January 2014, an ...

  8. 通过yum升级CentOS/RHEL最小化安装

    1.如果你有安装CentOS / RHEL最小服务器安装,您可能有很多麻烦没有安装包 2.有一种方法来安装所有的包,需要一个基本的服务器,使用yum groupinstall命令 3.从最小的安装基本 ...

  9. 在CentOS/RHEL 6.5上安装Chromium 谷歌浏览器

    之前Google就说了,由于CentOS/RHEL 6已经是过期的系统,所以不再会有Chrome了. 虽然后来由于引起了社区的抗议,从而改口,不再提CentOS/RHEL 6是过期系统了:但是,目前在 ...

随机推荐

  1. Java精通并发-synchronized关键字原理详解

    关于synchronized关键字原理其实在当时JVM的学习[https://www.cnblogs.com/webor2006/p/9595300.html]中已经剖析过了,这里从研究并发专题的角度 ...

  2. Range与面向对象的Kotlin

    在上一次https://www.cnblogs.com/webor2006/p/11186089.html中已经用到了范围相关的东东了,如下: 所以这次专门针对Koltin范围相关的东东再来细学一下, ...

  3. vuex传值的使用

    1.导入vuex import Vuex from 'vuex' Vue.use(Vuex); 2.创建store实例 let store = new Vuex.Store({ state:{ cou ...

  4. 创建型模式(过渡模式) 简单工厂模式(Simple Factory)

    简单工厂模式(Simple Factory Pattern)属于类的创建型模式,又叫静态工厂方法模式(Static FactoryMethod Pattern) 是通过专门定义一个类来负责创建其他类的 ...

  5. PHP——curl设置请求头需要注意哪些

    前言 在设置这个请求头上踩了一些坑,此文记录下. 步骤 设置请求头 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 请求头写法 一定不要忘记:不然进行请求 ...

  6. 关闭win10 任务栏窗口预览的步骤:

    win10虽好,但是总有不利于使用的反人类设计,好在可以设置,这也是比较好了的, 作为开发人员,经常会开好几个窗口,但是win10的预览很不好,设计的就是娱乐用途一般,因此必须是把他关了 一下步骤亲自 ...

  7. Hive节点及原理

    1.什么是Hive:hive是一种基于hadoop的数据仓库,能够将结构化的数据映射成一张表,并提供HQL进行查询.其数据是存储在hdfs上,本质是将sql命令转化成MapReduce来执行. 2.H ...

  8. Chrome抓包小技巧

    1.抓包时如果有页面跳转,记得把preserve log这个选项勾上

  9. Dubbo生产者和消费者经典案例

    一.导入依赖 <dependency> <groupId>javaee</groupId> <artifactId>javaee-api</art ...

  10. codepush安装

    https://github.com/lisong/code-push-server/blob/master/docs/README.md =====> 安装mysql下载mysql yum r ...