Linux 时间服务器同步设置

1、之前未安装过ntp直接执行安装命令yum -y install ntp即可

[root@node01 hadoop]# yum -y install ntp
Loaded plugins: fastestmirror
Determining fastest mirrors
centos-office                                                                                                                                                                             | 3.7 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.6p5-12.el6.centos.2 will be installed
--> Processing Dependency: ntpdate = 4.2.6p5-12.el6.centos.2 for package: ntp-4.2.6p5-12.el6.centos.2.x86_64
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.6p5-12.el6.centos.2 will be installed
--> Finished Dependency Resolution
.............................
Running Transaction
  Installing : ntpdate-4.2.6p5-12.el6.centos.2.x86_64                                                                                                                                                        1/2 
  Installing : ntp-4.2.6p5-12.el6.centos.2.x86_64                                                                                                                                                            2/2 
  Verifying  : ntpdate-4.2.6p5-12.el6.centos.2.x86_64                                                                                                                                                        1/2 
  Verifying  : ntp-4.2.6p5-12.el6.centos.2.x86_64                                                                                                                                                            2/2 

Installed:
  ntp.x86_64 0:4.2.6p5-12.el6.centos.2                                                                                                                                                                           

Dependency Installed:
  ntpdate.x86_64 0:4.2.6p5-12.el6.centos.2                                                                                                                                                                       

Complete!

2、同步时间服务器时间

[root@node02 yum.repos.d]# ntpdate ntp1.aliyun.com
 7 Jul 23:53:25 ntpdate[1222]: step time server 120.25.115.20 offset 168.642068 sec
[root@node02 yum.repos.d]# 

遇见问题:

[root@node02 .ssh]# yum -y install ntp
Loaded plugins: fastestmirror
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

解决方法:修改yum源

[root@node01 yum.repos.d]# cat CentOS-Base.repo
[centos-office]
name=centos-office
failovermethod=priority
baseurl=https://vault.centos.org/6.10/os/x86_64/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值