Ubuntu 离线安装ntp 并部署 ntp 服务器及同步客户端时间

1. 离线安装ntp

在互联网机上使用root用户运行命令: apt-get install ntp

运行完后,相应的安装包会download到 /var/cache/apt/archives/下;我已经离线好的包(里边有相关依赖包,所以会比较大,大概200M)在这里:百度云盘离线安装包

下图是该目录下文件的截图

2363252-3a1dde00dc2c3f7a.png
图1 /var/cache/apt/archives/

离线安装的命令也是:使用root用户执行 apt-get install ntp

Ubuntu 离线安装ntp 并部署 ntp 服务器及同步客户端时间_第1张图片
图2 apt-get install ntp

安装完,查看 /etc/passwd,可以看到添加了一个新用户ntp


2363252-9c286bb64d1ca1d0.png
图3  /etc/passwd查看ntp用户

2.配置ntp服务器

配置ntp服务器的文件位置在/etc/ntp.conf


Ubuntu 离线安装ntp 并部署 ntp 服务器及同步客户端时间_第2张图片
图4 ntp.conf配置

配置完后,重启ntp, 命令为:

service ntp restart  或者 /etc/init.d/ntp restart


2363252-c7c5e28cc69902b1.png
图 5 ntp 服务重启

3. 客户端 ntpdate向ntp 服务器发送同步时间请求

ntpdate 220.130.158.71


你可能感兴趣的:(Ubuntu 离线安装ntp 并部署 ntp 服务器及同步客户端时间)