欢迎登陆真网站,您的到来是我们的荣幸。 登陆 注册 忘记密码? ☆设为首页 △加入收藏
欢迎加入真幸福QQ群
电脑知识: 基础知识 网络技术 操作系统 办公软件 电脑维修 电脑安全 windows7 windows8 windows10 服务器教程 平板电脑 视频播放教程 网络应用 互联网 工具软件 浏览器教程 QQ技巧 输入法教程 影视制作 YY教程 wps教程 word教程 Excel教程 PowerPoint
云南西双版纳特产小花糯玉米真空包装


会声会影视频特效技巧
将Linux中systemd的单元配置实例化的方法
Linux系统下VNC SERVER的相关配置
在Linux中使用unixbench来测试测试系统性能
win8 diy你的右键菜单
word2013中插入表格有哪些方法
在Linux上怎么安装和配置DenyHosts工具以便进行自动屏ip
Windows10“你好小娜”唤醒如何开启
详解在Linux系统中如何管理systemd服务
Windows 8如何加速关机
在各种Linux系统的服务器上设置时间同步的方法
【 来源:网络 】【 点击:1 】 【 发布时间:2017_03_03 08:59:59 】

   独立主机

  rm -rf /etc/localtime

  ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #修改时区到东8区。

  date -R #查看的时区设置。

  接下来调整系统时间与时间服务器同步

  Debian系统安装NTP校时包:

  代码如下:

  apt-get install ntpdate #安装ntp

  CentOS系统安装NTP校时包:

  代码如下:

  yum -y install ntpdate ntp #安装ntp

  Ubuntu系统安装NTP校时包:

  代码如下:

  sudo apt-get install -y ntpdate ntp

  修改/etc/ntp.conf

  vi /etc/ntp.conf 就会看到以下内容:

  代码如下:

  server 0.centos.ntp.org

server time.windows.com

server time.nist.gov

  这是默认的ntp同步服务器,大家可以自己改,全球ntp服务器地址:http://www.pool.ntp.org/

  我改成了:

  代码如下:

  server cn.pool.ntp.org //这中国的ntp服务器

  server time-a.nist.gov

  server time.windows.com

  server time.nist.gov

  然 后保存退出(vi退出的方法见:http://www.dabu.info/personal-summary-personally-i- carefully-collected-must-be-familiar-with-vim-shortcut-key-operation.html)

  接着输入下面的命令:

  代码如下:

  ntpdate -d cn.pool.ntp.org #调试查看时间差异

ntpdate cn.pool.ntp.org #同步时间

date -R # 检查时间是否同步

  修改 ntp 的配置文件

  代码如下:

  vi /etc/sysconfig/ntpd

SYNC_HWCLOCK=yes #同步独立主机的硬件时钟

 

#配置开机启动ntp服务,定期同步时间

chkconfig --levels 235 ntpd on #启动ntp同步

/etc/init.d/ntpd start

  XEN VPS

  最好是安装ntp服务,这样可以解决vps在重启后时间不准的问题。有时候,依靠母鸡的硬件时钟,总是差七八分钟。实在没辙了。而已很多的web服务,如Google Authenticator等,如果时间不同步,会导致无法验证的地步,自然就网站都登陆不上了。

  代码如下:

  rm -rf /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #修改时区到东8区。

date -R #查看的时区设置。

  接下来调整系统时间与时间服务器同步

  Debian系统安装NTP校时包:

  代码如下:

  apt-get install ntpdate #安装ntp

  CentOS系统安装NTP校时包:

  代码如下:

  yum -y install ntpdate ntp #安装ntp

  Ubuntu系统安装NTP校时包:

  代码如下:

  sudo apt-get install -y ntpdate ntp

  修改/etc/ntp.conf

  vi /etc/ntp.conf 就会看到以下内容:

  代码如下:

  server 0.centos.ntp.org

server time.windows.com

server time.nist.gov

  这是默认的ntp同步服务器,大家可以自己改,全球ntp服务器地址:http://www.pool.ntp.org/

  我改成了:

  代码如下:

  server cn.pool.ntp.org //这中国的ntp服务器

  server time-a.nist.gov

  server time.windows.com

  server time.nist.gov

  然 后保存退出(vi退出的方法见:http://www.dabu.info/personal-summary-personally-i- carefully-collected-must-be-familiar-with-vim-shortcut-key-operation.html)

  接着输入下面的命令:

  代码如下:

  ntpdate -d cn.pool.ntp.org #调试查看时间差异

ntpdate cn.pool.ntp.org #同步时间

date -R # 检查时间是否同步

 

#配置开机启动ntp服务,定期同步时间

chkconfig --levels 235 ntpd on #启动ntp同步

/etc/init.d/ntpd start

 

#先设置XEN 的VPS使用和系统无关的时间模式

echo 1 > /proc/sys/xen/independent_wallclock

  然后尝试上面独立主机的配置方法即可。通过配置时间正确后,编辑系统配置文件,让配置永久生效。

  代码如下:

  vi /etc/sysctl.conf

xen.independent_wallclock=1 #在文件中增加并且保存

  OpenVZ VPS

  (Burst VPS 采用)

  OpenVZ的VPS直接从物理机读取时间不允许对主机进行时间修改,你只需修改时区。我还没用过openvz vps,所以,不清楚能否用ntp服务不,可以试试安装ntp service 看。如果可以的话,请告诉我。

  代码如下:

  rm -rf /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #修改时区到东8区。

date -R #查看时间和时区

  此时如果时间和时区都正确,配置成功,时间如果不对,需要联系主机服务商的技术支持,让他们把母鸡(物理机)时间同步,你的VPS时间就会正常。

本网站由川南居提供技术支持,fkzxf版权所有 浙ICP备12031891号
淳安分站 淳安分站