Centos7 compile and install ntp-4.2.8p11

Centos7 compile and install ntp-4.2.8p11

background##

Due to the company’s equivalent guarantee rating, it was found that ntp needs to be upgraded to ntp-4.2.7p25 or higher during security vulnerability detection. After some searching, there is no yum installation package for this version and the new version of ntp, so I can only compile and install it. I found two articles on the Internet, but the reference value is average, so I explored the pit myself and recorded it here.

surroundings##

installation##

Download the installation package###

# Official download
$ wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p11.tar.gz

# Unzip the installation package
$ tar zxvf ntp-4.2.8p11.tar.gz

# Global configuration
$ cd ntp-4.2.8p11/
$ ./configure --prefix=/usr/local/ntp --bindir=/usr/local/ntp/sbin --sysconfdir=/etc --libexecdir=/usr/local/ntp/libexec --docdir=/usr/local/ntp/doc/ntp --enable-linuxcaps  --with-lineeditlibs=readline  --enable-all-clocks --enable-parse-clocks --enable-clockctl --enable-ntpdate-step --enable-libopts-install   #Configuration(View usage guide--help)

# Error 1"/usr/bin/ld: cannot find -lcap"
# fix
$ find /-name "*libcap.so*""
$ ln -sv /usr/lib64/libcap.so.2/usr/lib/libcap.so

# Error 2
“ntpd.c:120:29:Fatal error: sys/capability.h: There is no such file or directory"
# fix
$ yum install -y libcap-devel

$ make && make install   #Compile&&installation
$ echo $?   #Check if there is an error in the installation process, 0 means yes

*Note: ** Since the initial deployment of the local system environment has been completed, the installation of some dependent packages is omitted. If you encounter a lack of some lib, you can install it directly with yum.

Configuration

After the installation is complete, there is no configuration file generated, you need to create it manually. The official designation of the default configuration file is: /etc/ntp.conf.

$ vim /etc/ntp.conf

driftfile /var/lib/ntp/drift  #Specify the time drift record file. Function: If ntpd is stopped and restarted, it will initialize the frequency from this file and avoid possible long time intervals to relearn and correct.

# Specify remote ntp server
server 202.120.2.101  prefer iburst minpoll 4 maxpoll 6  
## prefer: preferential use
## minpoll && maxpoll:
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org

statistics loopstats peerstats clockstats

filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

restrict -4default kod notrap nomodify nopeer noquery
restrict -6default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict 10.9.255.1
restrict 10.9.255.2
restrict ::1

Start ntpd

Finished (a lot of pits are stepped on, the biggest pit this time is related to --enable-ipv6. If you also encounter a problem that make cannot pass during the installation process, pass this parameter directly. The specific reason is also troubled by the passing gods.) ! ! !

reference##

Recommended Posts

Centos7 compile and install ntp-4.2.8p11
CentOs7.3 compile and install Nginx 1.9.9
Centos compile and install Git
CentOS 6.9 compile and install python
CentOS 6 compile and install python 3
CentOS Yum compile and install MySQL 5.6
CentOS 6.x compile and install Nginx
CentOS7 compile and install L(A|N)MP environment
Linux CentOS6 compile and install Pyt
Install centos7 and connect
Compile and install libmodbus library under CentOS7
CentOS7.5 source code compile and install mysql5.7.29
Centos7 compile and install MySQL8 problem record
Compile and install nodejs and yum in Centos8
CentOS7.4 source code compile and install MySQL8.0
Centos6.5 compile and install LNMP architecture web environment
Centos7.2 compile and install way to build phpMyAdmin
CentOS 7 install Mono and MonoDevelop
Ubuntu 16.04 compile and install PHP 7.2
ubuntu18.04 compile and install python3.8
Centos6.5 install and configure mongodb
CentOS7 install python3 and pip3
CentOS7 install OracleJDK and JRE
CentOS6.5 install Java 8 and Tomcat8
CentOS6 install and crack Jira 7
CentOS6.5 install Java 8 and Tomcat8
CentOS6 install and crack confluence
CentOS6 install and crack Jira 7
Centos compile and install LAMP (apache-2.4.7 + mysql-5.5.35 + php 5.5.8) + Redis
1.5 Install Centos7
Compile and install Lnmp shell script under Linux centos
Centos 7 install jdk and package service service
Install and configure keepalived under CentOS 5.9
CentOS7.3 install iptables and detailed use
CentOS quickly install Python3 and pip3
CentOS7 yum install and start mysql
CentOS 8 - install and configure NFS service
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Centos7 uninstall openJdk, and install JDK1.8
Install and use docker under CentOS 6.8
CentOS7 install and use SQL Server
CentOS Minimal install and configure TIPS
Install Python3 and Py under CentOS7
Install and configure FreeIPA in Centos7
Compile and install QEMU under Ubuntu
virtualBox install centos, and build tomcat
Install Mono 3.2 and Jexus 5.4 under CentOS 6.3
Compile and install the open source EDA tool-Surelog on CentOS8
CentOS8 deploys LNMP environment to compile and install mysql8.0.29 tutorial details
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
Vmware install CentOS6
CentOS 7 install Hadoop 3.0.0