CentOS时间同步

简介:

CentOS时间同步

安装ntpdate

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[root@node-01 ~] # yum install ntpdate -y
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
  * base: mirrors.163.com
  * extras: mirrors.zju.edu.cn
  * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.6p5-10.el6.centos.2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================
  Package                    Arch                      Version                                     Repository               Size
================================================================================================================================
Installing:
  ntpdate                    x86_64                    4.2.6p5-10.el6.centos.2                     base                     78 k
Transaction Summary
================================================================================================================================
Install       1 Package(s)
Total download size: 78 k
Installed size: 123 k
Downloading Packages:
ntpdate-4.2.6p5-10.el6.centos.2.x86_64.rpm                                                               |  78 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
   Installing : ntpdate-4.2.6p5-10.el6.centos.2.x86_64                                                                       1 /1 
   Verifying  : ntpdate-4.2.6p5-10.el6.centos.2.x86_64                                                                       1 /1 
Installed:
   ntpdate.x86_64 0:4.2.6p5-10.el6.centos.2                                                                                      
Complete!

同步时间

1
2
[root@node-01 ~] # /usr/sbin/ntpdate cn.pool.ntp.org
27 Jul 15:24:41 ntpdate[1674]: step  time  server 85.199.214.101 offset -27705.095972 sec

加到定时任务中

1
2
3
4
[root@node-01 ~] # crontab -e
[root@node-01 ~] # crontab -l
# time sync
* /5  * * * *  /usr/sbin/ntpdate  cn.pool.ntp.org > /dev/null  2>$1









本文转自 运维小当家 51CTO博客,原文链接:http://blog.51cto.com/solin/1951459,如需转载请自行联系原作者
目录
相关文章
|
Linux
linux的centos版本修改时间重启后无效的问题
安装完centos后,发现时间与本地时间不匹配,在网上找了好多的办法,但是一直没有奏效,重启之后,又恢复为原来的时间。很是纳闷
2750 0
|
Linux
CentOS设置精准时间
版权声明:本文为博主chszs的原创文章,未经博主允许不得转载。 https://blog.csdn.net/chszs/article/details/79332630 CentOS设置精准时间 2018.2.17 版权声明:本文为博主chszs的原创文章,未经博主允许不得转载。
1149 0
|
Linux
centos7时间同步和时区设置
centos7时间同步和时区设置 安装ntp服务的软件包 sudo yum install ntp 将ntp服务设置为缺省启动 systemctl enable ntpd 修改启动参数,增加-g -x参数,允许ntp服务在系统时间误差较大时也能正常工作 sudo vi /etc/sysconfig/ntpd 启动ntp服务 sudo service ntpd restart 将系统时区改为上海时间 (亦即CST时区) ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 查看时间是否正确 执行date命令即可。
1559 0
|
Linux
centos时间同步方法
centos时间同步方法 电脑软硬件应用网 45IT.COM 时间:2012-12-08 18:09 作者:李本清 新装的服务器可能设置了错误的,需要调整时区并调整时间.如下是使用NTP来从一个时间服务器同步 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ntpdate us.
841 0

热门文章

最新文章