当前位置: 首页 > article >正文

linux(rocky)设置更新服务器时间

linux(rocky)设置更新服务器时间

前言

CentOS8(或rocky8)系统中,原有的时间同步服务 ntp/ntpdate服务已经无法使用,使用yum安装,提示已不存在。如下:

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

要解决更新服务器时间问题,按下列步骤进行:

1 首先安装chrony

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

下列是一些chrony相关的命令:

1.1 开启chronyd服务

[root@localhost ~]# systemctl start chronyd

1.2 设置开机自启动

[root@localhost ~]# systemctl enable chronyd

1.3 设置开机自启动从配置文件中保存退出后,重启chronyd服务

[root@localhost ~]# systemctl restart chronyd

2 修改配置文件,即永久设置同步时间服务器

vi /etc/chrony.conf 

在首行增加:

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
pool ntp1.aliyun.com iburst
pool ntp2.aliyun.com iburst
pool ntp3.aliyun.com iburst
pool ntp4.aliyun.com iburst
pool ntp5.aliyun.com iburst
pool ntp6.aliyun.com iburst

保存(wq),退出

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

systemctl restart chronyd
systemctl enable chronyd

4 使用 date命令查看服务器时间执行结果


http://www.kler.cn/a/570374.html

相关文章:

  • 开源操作系统纷争:CentOS停服后的新战场
  • 【PromptCoder + Cursor】利用AI智能编辑器快速实现设计稿
  • 爬虫结合 t_nlp_word 文本语言词法分析接口:开启数据挖掘与分析的新篇章
  • VTK知识学习(44)- 表面重建
  • miqiu的分布式锁(四):MySQL悲观锁解析
  • Go的基本语法学习与练习
  • leetcode24-----两两交换链表中的节点
  • 如何打造一个安全稳定的海外社媒账号?
  • element UI => element Plus 差异化整理
  • 广义表(C语言代码链式存储结构)
  • 【Linux网络-HTTP协议】HTTP基础概念+构建HTTP
  • 芯麦GC1262E与APX9262S驱动芯片对比:电脑散热风扇应用的性能优势与替代方案
  • 大型语言模型中微调和提炼的详细技术比较
  • React学习笔记09
  • Oracle删除重复数据保留其中一条
  • 计算机毕业设计SpringBoot+Vue.js航空机票预定系统(源码+文档+PPT+讲解)
  • 力扣hot100---只出现一次的数子
  • 外卖跑腿APP小程序开发 餐饮点餐同城配送
  • sql-labs less5-8
  • 【问题记录】Go项目Docker中的consul访问主机8080端口被拒绝