Linux时间与系统时间相差8小时的解决办法
1.原因是时区不同
在/etc/profile文件中增加一行 export TZ='CST-8'
2.使文件立即生效
source /etc/profile 或者 . /etc/profile
3.输入ntpdate time.nist.gov同步网络时间
结果:3 Jun 15:42:39 ntpdate[4721]: adjust time server 211.115.194.21 offset -0.005885 sec
出现上述结果代表时间同步成功,上面的大致意思为调整时间为服务器211.115.194.21的时间,相差-0.005885秒的时间
如果上面time.nist.gov服务器同步不了,可以换下面几个时间服务器试试:
time.nist.gov
time.nuri.net
-u ntp.api.bz
0.asia.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
3.asia.pool.ntp.org
4.同步时间成功后调整硬件时间
#hwclock -w
执行成功后, 查看系统硬件时间(不出意外的话,现在date和hwclock现实的时间均为internet时间)