Linux同步时间方法CentOS同步时间方法 Linux系统

admin 2017-07-31 4022

一、在需要集中记录服务器日志的环境中,时间同步那是相当的重要的。本文为大家介绍同步linux时间的方法,供大家参考


1、如果不支持ntpdate命令,需要先安装ntpdate工具

yum -y install ntp ntpdate


2、删除本地时间并设置时区为中国上海

rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime


3、设置系统时间与网络时间同步

ntpdate ntp.api.bz

提供5个备用地址

ntpdate cn.pool.ntp.org

ntpdate 0.cn.pool.ntp.org

ntpdate 1.cn.pool.ntp.org

ntpdate 2.cn.pool.ntp.org

ntpdate 3.cn.pool.ntp.org

或者(中国国家授时中心)

ntpdate -u 210.72.145.44

备注:--u参数可以越过防火墙与主机同步;


4、将系统时间写入硬件时间

hwclock --systohc


5、查看系统时间的命令

date

6、查看硬件时间的命令

hwclock


二、手动设置时间方法

1、手动设置时间命令【date –set(月/日/年 时:分:秒)】

例如: date –set “7/31/17 23:59:59”
最新回复 (0)
全部楼主
    • MSDN,我告诉你(中文站)
      2
        登录 注册 获取赞助码
返回