Linux配置时间服务

本文介绍了如何在Linux系统中安装并配置NTP服务,以实现与阿里云NTP服务器的时间同步。首先通过yum安装ntp,然后启动并设置ntpd服务开机启动。接着,修改/etc/ntp.conf配置文件,替换默认的NTP服务器地址为阿里云的NTP服务器地址,并保存更改。最后,重启ntpd服务并使用ntpstat和date命令检查时间同步情况。
摘要由CSDN通过智能技术生成

Linux配置时间服务

###安装ntp

yum install ntp

###启动ntp服务

systemctl start ntpd.service

设置开机启动

systemctl enable ntpd.service

修改配置文件,添加阿里云ntp服务器地址

vim /etc/ntp.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

添加

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

###重启ntpd服务

systemctl restart ntpd

检查服务(时间服务不是时时的可以间隔一会再检查)

ntpstat
date.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值