加入收藏 | 设为首页 | 会员中心 | 我要投稿 海南站长网 (https://www.0898zz.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 系统 > 正文

CentOS7怎么修改服务器系统时间

发布时间:2022-10-19 14:32:26 所属栏目:系统 来源:转载
导读: 本篇内容介绍了“CentOS7怎么修改服务器系统时间”的有关知识查看服务器系统,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希

本篇内容介绍了“CentOS7怎么修改服务器系统时间”的有关知识查看服务器系统,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

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

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

$?timedatectl
local?time:?mon?2016-08-29?16:20:35?cst
universal?time:?mon?2016-08-29?08:20:35?utc
rtc?time:?mon?2016-08-29?08:18:07
time?zone:?asia/shanghai?(cst,?+0800)
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?15:26:58$?timedatectl
local?time:?mon?2016-08-29?15:27:00?cst
universal?time:?mon?2016-08-29?07:27:00?utc
rtc?time:?mon?2016-08-29?07:27:00
time?zone:?asia/shanghai?(cst,?+0800)
ntp?enabled:?no
ntp?synchronized:?no
rtc?in?local?tz:?no
dst?active:?n/a

ps:下面看下centos修改服务器系统时间

linux安装完毕后,一般都是国外的世界,一点都不方便设置任务,或者导致网站获取本地的时间错乱,所以就需要把服务器的时间改为和本地时间一致,也就是换成中国的时间。

(编辑:海南站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!