CentOS VPS Modified Time zone The final solution of different steps

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

  

Because of the initial use of the domestic Hyper-V architecture VPS and before buying to specify the installation of Windows or CentOS system, because the wood has a reload of the panel, for the use of Debian I really torture, the operation of the process encountered a variety of small problems. Ask customer Service directly a sentence only understand winows environment, let you install win you have to install Linux. Well, CentOS can only grope for himself. Because Hyper-V is a virtualization product for Microsoft, which didn't support Linux earlier, and because of Debian's corporate operation, which has made Debian into a fast-growing phase, even Google has abandoned Linux customization to the Debian development camp, making Microsoft feel some pressure , Microsoft pulled up CentOS, which is why Hyper-V only supports CentOS, not other Linux derivative versions, and the support is not so reliable. Spit it out, then come to the point.

Topic: Hyper-V Architecture centos5.5 VPS installed LNMP time is not synchronized, resulting in some features of the site can not be used.

All the methods found on the internet failed. Then I looked for some documents and finally finished, tears running AH.

Linux's time management is strange he divides into the system time and the hardware time also subdivides into what UTC time. -_-| | |

Hardware time is fundamentally CMOS clock

Linux View hardware time: Hwclock--show

Linux View system time: Date-r

CentOS VPS Time zone synchronization.

System Time Section:

1. Edit time zone configuration file: Vi/etc/sysconfig/clock

Zone= "Asia/shanghai"

Utc=false #把UTC设置为false关闭状态

Arc=false

2. Run the following command

#删除默认配置

Rm-rf/etc/localtime

#重新指定配置

Ln-s/usr/share/zoneinfo/asia/shanghai/etc/localtime

#同步系统时间

Ntpdate-u pool.ntp.org

3. Hardware Time section:

#将硬件时间调整成与目前的系统时钟一致.

Hwclock--SYSTOHC

or clock--SYSTOHC

#强制系统时间写入CMOS中防止重启失效

Hwclock-w

or clock-w

The above steps, although successful, but my Hyper-V architecture CentOS system time is not allowed to go, 1 days can be a few minutes.

Use crontab to sync time to solve.

#编辑计划任务表

Vi/etc/crontab

#表中最后添加下面这行内容

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

#每天5点半同步时间, clock--SYSTOHC is the meaning of the hard disk Time synchronization system time.

Related Article

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.