朱纯树博客
VPS测评推荐网站
cloudacead cloudacead

设置Linux VPS系统同步时间和时区简单方法

80%的VPS用户入手VPS之后可能就直接选择自己习惯的系统,然后按照一键包、WEB面板配置环境,或者有其他项目需求的直接按照系统。很少有更改系统时间和时区的习惯,如果遇到面板与时区兼容问题,比如WDCP这类面板,如果时间与当前时间有冲突的时候会登陆不进去面板,一直处于登录界面。以及有些程序在提交文章或者是项目提交时间的时候与实际的操作是有误差的,这个时候我们就需要调整VPS系统时间与实际当前需要的时间同步。

第一、修改北京时区
这里以修改北京时间作为默认时区,如果有其他需要的,可以对应修改。

rm -rf /etc/localtime #先删除默认的时区设置
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #替换上海/北京作为默认

第二、手工修改当前系统的时间

date -s '14:00:00 2019-11-26'

这里以修改为当前时间为例子。

第三、设置同步时间

ntpdate us.pool.ntp.org

设置同步服务器时间,安装完毕之后,我们用date测试下当前时间。
一般的VPS都有安装NTP,如果没有安装我们需要先安装apt-get install ntpdate(debian系统)。
总结,这样我们通过上面的3步骤就快速的实现Linux VPS系统时间与当前需要的时区和时间同步一致,确保项目的正常运行。

赞(0) 打赏
未经允许不得转载:VPS测评推荐网站 - 朱纯树博客 » 设置Linux VPS系统同步时间和时区简单方法

评论 21

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #30

    Greetings! Very useful advice within this post! It’s the little
    changes which will make the largest changes. Thanks a
    lot for sharing!

  2. #29

    Nice blog right here! Additionally your website rather a lot up fast!
    What web host are you the usage of? Can I am getting your affiliate hyperlink on your host?
    I desire my site loaded up as quickly as yours lol

  3. #28

    After going over a number of the articles on your blog, I
    honestly like your way of writing a blog. I added it to my bookmark webpage list and will be checking back soon. Please visit my web site as well and tell me how you feel.

    tinyurl.com1周前 (08-01)回复
  4. #27

    I know this web site provides quality based posts and extra stuff,
    is there any other web page which offers these kinds of data
    in quality?

  5. #26

    Good post but I was wanting to know if you could write
    a litte more on this topic? I’d be very grateful if you could elaborate a little bit more.
    Thank you!

  6. #25

    I always spent my half an hour to read this webpage’s posts daily along with
    a mug of coffee.

    tinyurl.com4周前 (07-16)回复