centos7:ntp 升级:ntp-4.2.8p16

获取文件

[root@localhost ~]# wget https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2.8p16.tar.gz

卸载原有的 ntp 软件,centos7 默认 yum 版本都是 4.2.6p5

[root@localhost ~]# yum remove -y ntp ntpdate

解压文件

[root@localhost ~]# tar -zxvf ntp-4.2.8p16.tar.gz

安装依赖

[root@localhost ~]# yum install -y gcc-c++

编译安装

[root@localhost ~]# cd ntp-4.2.8p16
[root@localhost ntp-4.2.8p16]# ./configure --prefix=/usr/local/ntp-4.2.8p16 
[root@localhost ntp-4.2.8p16]# make && make install

创建软链接

[root@localhost ntp-4.2.8p16]# ln -s /usr/local/ntp-4.2.8p16 /usr/local/ntp

make过程可能会出现如下问题:编译错误中没有提示说找不到静态库,那就说明链接了静态库' -lssl -lcrypto',但静态库中没有函数EVP_MD_CTX_new 的定义。

libsntp.a(crypto.o): In function `compute_mac':
/opt/soft/ntp-4.2.8p16/sntp/crypto.c:82: undefined reference to `EVP_MD_CTX_new'
/opt/soft/ntp-4.2.8p16/sntp/crypto.c:120: undefined reference to `EVP_MD_CTX_free'
collect2: error: ld returned 1 exit status
make[4]: *** [sntp] Error 1
make[4]: Leaving directory `/opt/soft/ntp-4.2.8p16/sntp'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/opt/soft/ntp-4.2.8p16/sntp'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/soft/ntp-4.2.8p16/sntp'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/soft/ntp-4.2.8p16'
make: *** [all] Error 2

出现以上问题的原因:大概就是因为你升级了 openssl 导致找不动相关函数的定义,如果你要编译升级 ntp 或者安装 ntp,建议是升级 openssl 之前进行,如果已经升级,可以考虑以下我提供的方法:

1.下载 openssl-1.1.1 进行编译安装

下载地址:/source/old/1.1.1/index.html

2.编译安装

[root@localhost ~]# cd openssl-1.1.1
[root@localhost openssl-1.1.1]# ./config --prefix=/usr/local/openssl-1.1.1
[root@localhost openssl-1.1.1]# make
[root@localhost openssl-1.1.1]# make install

3.重新编译安装 ntp-4.2.8p16,需要指定 openssl

[root@localhost ~]# cd ntp-4.2.8p16
[root@localhost ntp-4.2.8p16]# ./configure --prefix=/usr/local/ntp-4.2.8p16 --with-openssl-libdir=/usr/local/openssl-1.1.1/lib
[root@localhost ntp-4.2.8p16]# make CFLAGS=-fPIC
[root@localhost ntp-4.2.8p16]# make install
[root@localhost ntp-4.2.8p16]# ln -s /usr/local/ntp-4.2.8p16 /usr/local/ntp

4.修改配置文件并启动服务

[root@localhost ~]# /usr/local/ntp/bin/ntpd -c /etc/ntp.conf
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

啊 这

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值