Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the server system time by CentOS7

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to modify the server system time in CentOS7". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In centos 7, there is a command timedatectl that can help us change the time zone of the server.

1. Check the time setting timedatectl in the server, which is equivalent to timedatectl status:

$timedatectllocal time: mon 2016-08-29 16:20:35 cstuniversal time: mon 2016-08-29 08:20:35 utcrtc time: mon 2016-08-29 08:18:07time zone: asia/shanghai (cst, + 0800) ntp enabled: yesntp synchronized: nortc in local tz: nodst active: Numbera

two。 Learn about the parameters of the timedatectl command:

$timedatectl-htimedatectl [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 modecommands:status show current time settingsset-time timeset system timeset-timezone zone set system time zonelist-timezones show known time zonesset-local-rtc bool Control whether rtc is in local timeset-ntp bool control whether ntp is enabled

3. Set time

$sudo timedatectl set-time 15:26:58$ timedatectllocal time: mon 2016-08-29 15:27:00 cstuniversal time: mon 2016-08-29 07:27:00 utcrtc time: mon 2016-08-29 07:27:00time zone: asia/shanghai (cst, + 0800) ntp enabled: nontp synchronized: nortc in local tz: nodst active: n cst a

Ps: let's take a look at the time when centos modifies the server system

After the installation of linux, it is generally a foreign world, so it is not convenient to set tasks at all, or it may lead to the confusion of the time for the website to get local, so it is necessary to change the time of the server to the same time as the local time, that is, the time of China.

The first instruction is: date-s' 2016-10-31 10 purl 10 purl 10'

The second instruction: clock-w / / write the date to cmos

The time is in accordance with the above format, and can be reused after the operation.

Date

Check the server time. If it is the same as set, it means it is successful.

This is the end of the content of "how to modify the server system time by CentOS7". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report