Because the first time I used the hyper-v architecture VPS, I had to specify whether to install windows or centos before I bought it. because of the 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 has entered a rapid development stage.
Because the first time I used the hyper-v architecture VPS, I had to specify whether to install windows or centos before I bought it. because of the 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, which is also subdivided into UTC and CSFT 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
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.