You are here: Home » All Categories » » 调整 Linux VPS 时间

调整 Linux VPS 时间

Oct 10th, 2011 20:40 | Leave a comment?(60) Go to comments

大部分朋友都喜欢用美国的 VPS 主机,原因嘛,大家懂的。

VPS 主机安装的 Linux 的时间通常是 GMT,北京时间要 +8 处理,所以我习惯安装配置好环境后,就用下面的命令修改时间为香港时间:

第一步:不使用UTC时间
vi /etc/default/rcS
将“UTC=yes”修改为“UTC=no”

第二步:修改本机时区
ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime

但是我今天在查看我另外一台 VPS 主机的时间时,发现主机的时间不准,显示香港时间是 13:07,而北京/上海/香港时间应该是 21:07

怎么会出现这个错误?我第一反应就是 VPS 主机的 GMT 时间有问题,于是翻查到 ntpdate 命令,我没具体去查看此命令的介绍,只知道下面这样就把时间校准了:(内容参考自这里

ntpdate stdtime.sinica.edu.tw

如果你的 VPS 提示没有 ntpdate 这个命令,可以通过下面的命令安装:

centos 系统

yum -y install ntpdate ntp

Debian 系统

apt-get install -y ntpdate ntp

Ubuntu 系统

sudo apt-get install -y ntpdate ntp

记得最后再执行一次 ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime

问题解决!

声明: 除非注明,ZWWoOoOo文章均为原创,转载请以链接形式标明本文地址
本文地址: http://zww.me/archives/25531

Filed under

| Tags:

, ,

Related Posts

Most Popular

60 Comments.

⊕Leave a comment?
  1. fly fly Google Chrome 17.0.928.0Windows 7

    其实什么vps教程网上一大把,用军哥的一键安装环境 lnmp 大部分环境都可以搞定,用win2003的直接掠过,地球人都知道用,不过时间问题我见很多米国vps服务商在你注册帐号的时候会让你选国家城市,我用Linode,装完系统直接就是+8了

    31楼
    • zwwooooo zwwooooo Firefox 8.0Windows 7 x64 Edition

      @fly
      军哥的不适合小内存,还要调整一大堆参数,所以我一般手动安装。

Leave a Reply


Welcome! o(∩_∩)o
X