1. Compilation and installation environment configuration
Official documentation: http://intel.github.io/hyperscan/dev-reference/getting_started.html
1.1 Hardware configuration
Configuration | parameter |
---|---|
CPU | Intel® Xeon® Gold 5218R CPU @ 2.10GHz |
Number of CPU cores | 8 cores |
Note: The following conditions need to be met
1. X86 architecture
2. Supplemental Streaming SIMD Extensions 3 (SSSE3)
1.2 Software configuration
Configuration | Requirement version | Use version |
---|---|---|
operating system | RedHat/CentOS 7 or newer | CentOS Linux release 8.4.2105 |
translater | GCC, v4.8.1 or higher | gcc (GCC) 8.4.1 |
1.3 Dependency configuration
rely | Requirement version | Use version |
---|---|---|
cmake | >=2.8.11 | 3.20.2 |
a man | 6.9 | 6.9 |
Python | 2.7 | 2.7.15 |
Boost | >=1.57 | 1.77.0 |
Pcap | >=0.8 | 1.10.1 |
2. Compile and install
2.1. Replace yum Alibaba Cloud Source (convenient to use yum software directly)
cd /etc/yum.repos.d/
mv CentOS-Linux-Base.repo CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
Modify CentOS-Linux-Base.repo
sed -i “%s/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g”
sed -i “s/$releasever/$releasever-stream/g”
Modify CentOS-Linux-AppStream.repo and CentOS-Linux-Extras.repo
to comment out the original mirrorlist, and then add a new line:
baseurl=https://mirrors.aliyun.com/centos/$releasever-stream/extras/$basearch/os/
Clear cache:
yum clean all
Generate cache:
yum makecache
2.2. Install cmake, gcc, gcc-c++, git
yum -y install cmake gcc gcc-c++ git
2.3. Clone source code
git clone https://github.com/intel/hyperscan.git
2.4. Compile and install python-2.7.15 (centos 8 comes with python3)
yum -y install make zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel
tar -zxf Python-2.7.15.tgz
cd Python-2.7.15
./configure --enable-optimizations --prefix=/usr/local/python2.7
make altinstall
ln -sf /usr/local/python2.7/bin/python2.7 /usr/bin/python
python -V
2.5. Compile and install Ragel
tar -zxf ragel-6.9.tar.gz
cd ragel-6.9
CXXFLAGS="-std=c++98" ./configure && make && make install
ragel --version
2.6. Deploy boost
tar -zxf boost_1_77_0.tar.gz
ln -sf /root/HyperscanTest/boost_1_77_0/boost /root/HyperscanTest/hyperscan/include/boost
2.7. Compile and install libpcap
yum -y install flex bison
tar -zxf libpcap-1.10.1.tar.gz
cd libpcap-1.10.1
./configure && make && make install
2.8. Compile and install hyperscan
2.8.1. Modify permissions
chmod -R 755 hyperscan
2.8.2. Create compilation directory
#hyperscan directory sibling
mkdir build
2.8.3. Compilation
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=on /root/HyperscanTest/hyperscan
2.8.4. Construction
cmake --build .
or
make -j
make install
Note: You can pass a parallelism parameter after make -j to allow multiple commands to be executed at the same time, such as make -j 16
2.9. Check (in the build directory)
2.9.1. Check whether the so library is generated
ll ./lib
2.9.2 Unit testing
./bin/unit-hyperscan