Home > Database > Mysql Tutorial > body text

CentOS系统时间与现在时间相差8小时解决方法

WBOY
Release: 2016-06-07 18:08:05
Original
1555 people have browsed it

很多网友在安装完CentOS系统后发现时间与现在时间相差8小时,这是由于我们在安装系统的时选择的时区是上海,而CentOS默认bios时间是utc时间,所以时间相差了8小时。这个时候的bios的时间和系统的时间是不一致的,一个代表utc时间,一个代表cst(+8时区),

很多网友在安装完CentOS系统后发现时间与现在时间相差8小时,这是由于我们在安装系统的时选择的时区是上海,而CentOS默认bios时间是utc时间,所以时间相差了8小时。这个时候的bios的时间和系统的时间是不一致的,一个代表 utc 时间,一个代表cst(+8时区),即上海时间。

下面是同步时间的解决方法:
1、vi /etc/sysconfig/clock   #编辑文件
     ZONE="Asia/Shanghai"
     UTC=false                          #设置为false,硬件时钟不于utc时间一致
     ARC=false

2、ln -sf /usr/share/zoneinfo/Asia/Shanghai    /etc/localtime    #linux的时区设置为上海
3、ntpdate 192.43.244.18    #对准时间,需要先安装ntp服务器 yum install ntp
4、/sbin/hwclock --systohc   #设置硬件时间和系统时间一致并校准

至此,linux系统时间和计算机硬件时间都是cst时间了,并且为上海时区。


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!