centos7.5 离线安装ntp服务
安装
#检查rpm包
rpm -qa | grep ntp
#从https://pkgs.org/download/ntp 下载rpm包
ntp-4.2.6p5-28.el7.centos.x86_64.rpm
ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm
libopts-5.18.12-alt2.x86_64.rpm
#server安装
rpm -ivh ntp-4.2.6p5-28.el7.centos.x86_64.rpm ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm libopts-5.18.12-alt2.x86_64.rpm
#slave安装
rpm -ivh ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm
配置
- 配置/etc/ntp.conf
配置下游服务器可以使用该服务的IP网段(192.168.0.0-192.168.0.255)
restrict 127.0.0.1
restrict 192.168.0.0 mask 255.255.255.0 nomodify
配置上游NTP服务器IP地址
server cn.pool.ntp.org
#外部时间服务器不可用时,以本地时间作为时间服务
server 127.127.1.0 #local clock
fudge 127.127.1.0 stratum 3
启动
server:
systemctl start ntpd
slave:
ntpdate 192.168.0.2(server_ip)
愿力量与你同在_YC