解决linux系统时间与网络时间不一致,linux同步网络时间,未找到匹配的参数: ntpdate,错误:没有任何匹配: ntpdate

方法一:
CentOS8系统中,原有的时间同步服务 ntp/ntpdate服务已经无法使用,使用yum安装,提示已不存在

[root@localhost ~]# yum install ntp
上次元数据过期检查:-1 day, 16:29:03 前,执行于 20231003日 星期一 190030秒。
未找到匹配的参数: ntp
错误:没有任何匹配: ntp

1、在CentOS8中,已使用chrony替代ntp,首先安装chrony

#使用dnf安装
dnf install -y chrony
# 也可以用yum安装
yum install -y chrony

2、永久设置同步时间服务器(修改配置文件)

vim /etc/chrony.conf 

3、注释掉第三行原有的时间服务器地址,设置为阿里云的时间服务地址
如果已经是阿里云的请忽略这一步

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

阿里云提供了7NTP时间服务器也就是Internet时间同步服务器地址

ntp1.aliyun.com
ntp2.aliyun.com
ntp3.aliyun.com
ntp4.aliyun.com
ntp5.aliyun.com
ntp6.aliyun.com
ntp7.aliyun.com

![在这里插入图片描述](https://img-blog.csdnimg.cn/0c1ecbc4e137414d933a1e6d85216e58.png

4、重启网络时间服务chrony,并设置服务后台运行

#重启时间服务
systemctl restart chronyd.service
#设置时间同步服务开机启动
systemctl enable chronyd.service

5、使用date查看当前时间

date

方法二:

1、安装CentOS系统NTP校时包

yum install ntp

2、校对时间命令

ntpdate cn.pool.ntp.org

cn.pool.ntp.org:是ntp网络授时组织的中国授时源

3、将硬件时钟调整为与目前的系统时钟一致

hwclock --systohc

4、查看当前系统时间

date