Centosvps Modification time: not synchronized in time zone: Ultimate Solution

Source: Internet
Author: User
Because the first time I used VPS in the hyper-v architecture in China, I had to specify whether to install windows or centos before I bought it. because I had a re-installed panel, I am really suffering from debian, various minor problems encountered during the operation. Ask the customer service to understand only the winows environment.

  

Because the first time I used VPS in the hyper-v architecture in China, I had to specify whether to install windows or centos before I bought it. because I had a re-installed panel, I am really suffering from debian, various minor problems encountered during the operation. Ask the customer service to simply understand the winows environment, so that you have to install linux for Windows. Well, centos can only be explored by yourself. Because hyper-v is a virtualization product of Microsoft, it was not supported by linux earlier. due to debian's corporatization operation, debian entered a stage of rapid development, even google has abandoned linux customization and moved to the debian development camp, which puts some pressure on Microsoft. Therefore, Microsoft has pulled centos, which is why hyper-v only supports centos, other linux derivative versions are not supported, and the supported versions are not so reliable. Let's take a look at the question.

Subject: The lnmp time of centos5.5 VPS in hyper-v architecture is not synchronized, and some functions of the website cannot be used.

All methods found online fail. Then I found some documents carefully and finally got it done.

Linux time management is very strange. it is divided into system time and hardware time into UTC time. -_-|.

The hardware time is basically a CMOS clock.

Linux: hwclock -- show

Linux system Time: date-R

Time zone synchronization for centos VPS.

System Time:

1. edit the time zone configuration file vi/etc/sysconfig/clock.

ZONE = "Asia/Shanghai"

UTC = false # set UTC to false to disable

ARC = false

2. run the following command:

# Deleting default configurations

Rm-rf/etc/localtime

# Resetting configuration

Ln-s/usr/share/zoneinfo/Asia/Shanghai/etc/localtime

# Synchronize system time

Ntpdate-u pool.ntp.org

3. hardware Time:

# Adjust the hardware time to be consistent with the current system clock.

Hwclock -- systohc

Or clock -- systohc

# Force system time to be written into CMOS to prevent reboot failure

Hwclock-w

Or clock-w

Although the above steps are successful, the time for my centos system in hyper-v architecture is incorrect. it may take several minutes in a day.

You can use crontab to synchronize the time.

# Editing a scheduler task table

Vi/etc/crontab

# Add the following line at the end of the table

30 5 * root/usr/sbin/ntpdate-u pool.ntp.org &/sbin/clock -- systohc

# The synchronization time at half past five every day. clock -- systohc indicates the time synchronization system time of the hard disk.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.