首页云计算 正文

如何在Rocky Linux上配置和使用NTP服务进行时间同步

2024-11-22 5 0条评论

如何在Rocky Linux上配置和使用NTP服务进行时间同步

发布时间:2024-05-16 10:53:11 来源:亿速云 阅读:812 作者:小樊 栏目:云计算

在Rocky Linux上配置和使用NTP服务进行时间同步的步骤如下:

  1. 安装NTP服务: 在终端中运行以下命令安装NTP服务:
sudo dnf install ntp
  1. 配置NTP服务: 编辑NTP配置文件,可以使用任何文本编辑器打开/etc/ntp.conf文件:
sudo vi /etc/ntp.conf

找到服务器列表部分,添加或修改NTP服务器,例如:

server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
  1. 启动NTP服务: 运行以下命令启动NTP服务:
sudo systemctl start ntpd
  1. 设置NTP服务开机启动: 运行以下命令设置NTP服务开机启动:
sudo systemctl enable ntpd
  1. 检查NTP服务状态: 运行以下命令检查NTP服务状态:
sudo systemctl status ntpd
  1. 手动同步时间: 如果需要手动同步时间,可以运行以下命令:
sudo ntpdate -u 0.centos.pool.ntp.org

至此,您已经成功在Rocky Linux上配置和使用NTP服务进行时间同步。现在,您的系统将会自动同步时间以保持准确。

文章版权及转载声明

本文作者:admin 网址:http://news.edns.com/post/140866.html 发布于 2024-11-22
文章转载或复制请以超链接形式并注明出处。

取消
微信二维码
微信二维码
支付宝二维码