温馨提示×

CentOS系统下的NTP时间同步服务怎么配置

小亿
90
2024-05-09 10:35:00
栏目: 智能运维

在CentOS系统下配置NTP时间同步服务可以通过以下步骤完成:

  1. 安装NTP软件包:
sudo yum install ntp
  1. 修改NTP配置文件/etc/ntp.conf,可以使用文本编辑器打开文件进行编辑:
sudo vi /etc/ntp.conf
  1. 在配置文件中添加NTP服务器地址,可以在server行后面加上NTP服务器地址,例如:
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
server 3.centos.pool.ntp.org
  1. 启动NTP服务并设置开机自启动:
sudo systemctl start ntpd
sudo systemctl enable ntpd
  1. 检查NTP服务状态:
sudo systemctl status ntpd
  1. 手动同步时间:
sudo ntpdate -u 0.centos.pool.ntp.org

以上是在CentOS系统下配置NTP时间同步服务的基本步骤,根据实际情况可以根据需要进行进一步配置。

0