0.基础包
确保已安装
yum install mpfr cpp ppl cloog-ppl gcc kernel-devel pcre-devel libpcap-devel yum-plugin-priorities yum-conf libyaml libyaml-devel libnet flex bison gcc-c++
第三步很坑的一点,官方文档也没写,要提前安装file-devel
yum install file-devel
ubuntu需要magic-devel
1.安装CUDA
最新版CUDA toolkit已包含cuda驱动。在官网下载cuda_6.5.14_linux_64.run
安装gcc与devel
yum install gcc kernel-devel reboot
关掉禁用Nouveau驱动以管理员身份登录系统,然后修改 /etc/modprobe.d/blacklist.conf文件,在文件后面加上blacklist nouveau,保存退出。
写入blacklist后,要重新建立initramfs image文件。
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname-r).img.bak dracut -v /boot/initramfs-$(uname -r).img $(uname -r)
设置系统以命令行界面启动
vi /etc/inittab
修改
id:3:initdefault:
(或者开机进入命令行界面输入 init3)
重启动电脑进入命令行模式,找到下载的nvidia驱动的文件路径,然后进行安装
./cuda_6.5.14_linux_64.run
在 /etc/rc.local文件中添加下面语句以便系统启动时能够启动NVIDIA CUDA
/sbin/modprobe -r nouveau && /sbin/modprobe nvidia
编译例子时会报错缺少lglut,即libglut,yum貌似对应freeglut
yum install *glut*
2.安装PF_RING
tar zxvf PF_RING-6.0.1.tar.gz
cd PF_RING-6.0.1/kernel make && make install cd ../userland/lib ./configure --prefix=/usr/local/pfring && make && make install cd ../libpcap-1.1.1-ring ./configure --prefix=/usr/local/pfring && make && make install cd ../tcpdump-4.1.1 ./configure --prefix=/usr/local/pfring && make && make install
加载pfring内核模块,添加到 /etc/rc.local中
/sbin/modprobe pf_ring
3.安装Suricata
tar zxvf suricata-2.0.3.tar.gz cd suricata-2.0.3
./configure --enable-gccprotect --enable-profiling --enable-cuda --with-cuda-includes=/usr/local/cuda/include --with-cuda-libraries=/usr/local/cuda/lib64 --enable-pfring --with-libpfring-libraries=/usr/local/pfring/lib --with-libpfring-includes=/usr/local/pfring/include --with-libpcap-libraries=/usr/local/pfring/lib --with-libpcap-includes=/usr/local/pfring/include/
指定libjansson位置
显卡使用了最低端的Geforce G210
此处make时发生错误:nvcc fatal : Value 'sm_10' is not defined for option 'gpu-architecture',由于不懂原理也查不到资料,忙活了三天才解决:
使用Fileseek查找suricata-2.0.3中包含sm_10的源文件并删除
make -j 16 make install
搞定!
4.配置