wget https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p15.tar.gz mkdir /tmp/ntp service ntp stop #关闭ntp服务,如果没有开启可以跳过 mv /usr/sbin/ntp* /tmp/ntp tar xvf ntp4/ntp-4.2/ntp-4.2.8p15.tar.gz cd ntp-4.2.8p15 vim include/ntp_syscall.h.patch #输入以下内容
--- ntp-4.2.4p7/include/ntp_syscall.h +++ ntp-4.2.4p7/include/ntp_syscall.h @@ -14,5+14,13 @@ #include #endif +#if defined(ADJ_NANO) && !defined(MOD_NANO) +#define MOD_NANO ADJ_NANO +#endif + +#if defined(ADJ_TAI) && !defined(MOD_TAI) +#define MOD_TAI ADJ_TAI +#endif + #ifndefNTP_SYSCALLS_LIBC #ifdefNTP_SYSCALLS_STD # cd include # patch -p0 < ntp_syscall.h.patch patch file to:ntp_syscall.h # cd .. # make && make install
cd include patch -p1 < ntp_syscall.h.patch #然后点击回车 cd .. ./configure --prefix=/usr/local/ntp --enable-all-clocks --enable-parse-clocks --enable-clockctl make make install cp /usr/local/ntp/bin/ntp* /usr/sbin/ #注意检查ntp.conf的配置 chkconfig ntp on service ntp start service ntp status ntpd --version