ntp服务器配置
一、ubuntu 20配置
1、安装 NTP 服务器安装包
apt-get install -y ntp2、编辑配置文件
修改配置文件/etc/ntp.conf,修改以下内容:
restict 192.168.8.1 mask 255.255.255.0 modify notrap server 127.127.1.0 fudge 127.127.1.0 stratum 103、启动NTP服务并设置为开机自启
sudo systemctl start ntp sudo systemctl enable ntp4、检查NTP服务状态和时间同步
sudo systemctl status ntp ntpq -p5、离线安装ntp
首先将离线安装包deb传输到离线机器
然后将离线包解压到目标文件夹
tar -xzvf /path/to/destination/ntp-offline.tar.gz -C /path/to/destination在离线机器上,进入解压目录并使用dpkg安装所有.deb包
cd /path/to/destination/ntp sudo dpkg -i *.deb如果安装过程中提示缺少依赖,可以尝试以下命令修复依赖:
sudo apt-get install -f二、ubuntu24配置
1、清理冲突,使用aptitude安装
sudo apt install aptitude sudo aptitude install ntp2、配置,创建/etc/ntp.conf
server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org server ntp.aliyun.com iburst server ntp1.aliyun.com iburst server ntp2.aliyun.com iburst server ntp.tuna.tsinghua.edu.cn iburst server 127.127.1.0 fudge 127.127.1.0 stratum 10