ntp对时

在 CentOS 中,可以使用 NTP(Network Time Protocol)协议来同步时间。以下是设置步骤:

  1. 安装 NTP 软件包:
yum -y install ntp
  1. 编辑 /etc/ntp.conf 文件,添加 NTP 服务器地址。例如,使用中国大陆的 NTP 服务器:
 server ntp1.aliyun.com prefer #添加ntp服务器地址为首要地址
 server ntp2.aliyun.com  #添加ntp服务器地址为备用地址
 server ntp3.aliyun.com  #添加ntp服务器地址为备用地址
  1. 重启 NTP 服务:
systemctl restart ntpd
service ntpd restart

#开机自启
chkconfig ntpd on
  1. 同步:
ntpq -p

THE END
点赞14 分享