1、嚼但匙噻首先打开ssh连接工具,输入服务器的IP地址,连接服务器;2、输入su,切换root用户;3、检查网络环境,可连接外网;4、输入sudo apt-get update,回车,更新系统。
2、输入sudo apt-get install ntp,回车安装ntp服务器。
3、输入sudovim/etc/ntp.conf,修改配置文件;2、在配置文件中的: restrict -6 default kod notrap nomodify 荏鱿胫协nopeer noquery 语句后面加入: restrict 192.168.80.0 mask 255.255.255.0 nomodify restrict 192.168.90.0 mask 255.255.255.0 nomodify注意:此配置是表示允许能同步的服务器所在的内部网段。3、保存,退出。
4、输入sudo /etc/init.d/ntp restart ,回车重启ntp服务。
5、输入ntpq -p,查看ntp服务启动是否正常。如下图所示为正常情况。
6、在需要ntp同步时间的客户端上输入 ntpdate xxx.xxx.xxx.xxx ,即可同步时间。注意:初次安装完后,直接输入,可能返回no server su足毂忍珩itable for synchronization found 错误,这是因为ntp server自身与时间服务器对时需要5分钟左右的时间造成。等5分钟再次尝试即可。