搭建时间服务器

1、必要条件====>所有机器都要安装ntp服务器。

  • 1、查看是否安装 ===> rpm -qa | grep ntp
  • 2、yum安装ntp服务器 ==> yum install -y ntp
  • 3、如果时间不是CST,而是EDT的,那么需要改为shanghai时间

mv /etc/localtime /etc/localtime.bak

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

2、其中一台机器作为ntp服务器端:

  • 1、首先同步一下网络时间

ntpdate -u cn.pool.ntp.org

  • 2、把自己的时间作为ntp时间==>1、vim /etc/ntp.conf
  •   把原本所有以server 开头的,都注释掉,然后加上两条
  •   server "127.127.1.0"  
  •   fudge  "127.127.1.0" stratum 10

3、其他机器作为ntp客户端

  • 1、其他节点机器 ==> vim /etc/ntp.conf。
  • restrict 192.168.85.0 mask 255.255.255.0 nomodify notrap

把原本所有以server 开头的,都注释掉,然后加上两条

server "上面那台服务器的IP地址"

fudge "时间服务器的IP地址" stratum 10

  • 2、启动ntpd服务器,并设置位开机启动

systemctl start ntpd

systemctl enable ntpd

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

转载于:https://www.cnblogs.com/leiwenbin627/p/11271568.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值