Autogenerated on 2012-11-29
from - https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Installation_with_CUDA_on_Ubuntu_server_1104


Installation with CUDA on Ubuntu server 11.04

THIS WOULD NOT WORK ON A VIRTUAL MACHINE!
This guide is written using:
Ubuntu Server 11.04
Linux ubuntu 2.6.38-8-generic x86_64 GNU/Linux

Pre installation requirements


  apt-get update
  apt-get upgrade

Get the CUDA toolkit

  http://developer.nvidia.com/cuda-toolkit-40

Pick up the correct NVIDIA drivers for your card and system

  http://www.nvidia.com/Download/index.aspx?lang=en-us

Go to your download directory
and chmod the 2 *.run files that you just downloaded.
Example:

  chmod 655 cudatoolkit_4.0.17_linux_64_ubuntu10.10.run
  chmod 655 NVIDIA-Linux-x86_64-280.13.run


  sudo apt-get -y install libpcre3 libpcre3-dbg libpcre3-dev \
  build-essential autoconf automake libtool libpcap-dev libnet1-dev \
  libyaml-0-2 libyaml-dev zlib1g zlib1g-dev libcap-ng-dev libcap-ng0 \
  make flex bison git

Run the cuda toolkit installation package:

  sudo ./cudatoolkit_4.0.17_linux_64_ubuntu10.10.run

Close all windows and as you are logged in press:

  Ctr+Alt+F1

Log in with your credentials

  sudo -i

And enter your password
Stop the x server:

  /etc/init.d/gdm stop

Uninstall xserver video drivers:

  apt-get remove --purge xserver-xorg-video-nouveau

Go to the directory where you downloaded nvidia/cuda drivers.

  Run the NVIDIA*******.run:
  ./NVIDIA********.run

Ok and yes your way out.
At some point it will ask you to make a special configuration file to disable a
"nouveau"
driver that the system is currently using and prevents the NVIDIA drivers to be
installed - say yes!
Reboot:

  shutdown -r now

After reboot log in as you would normally through the GUI
Log in as you would normally.
Go to shell:

  Ctrl+Alt+F1

Type in your credentials and pass

  sudo -i

Stop the xserver again:

  /etc/init.d/gdm stop

Run the NVIDIA driver again.
This time it would finish and be successful....
Reboot:

  shutdown -r now

After start you would notice that the display has much better resolution - it
is a good thing.
Log in as you would normally.
Because the 11.04 Ubuntu comes with gcc version 4.5 by default we need to
install gcc 4.4 since we must use 4.4 for the cuda compilation:

  apt-get install gcc-4.4 gcc-4.4-base g++-4.4

Then we switch and make ubuntu use the gcc 4.4 by default:

  sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.5 40 --
  slave /usr/bin/g++ g++ /usr/bin/g++-4.5
  udo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 60 --
  slave /usr/bin/g++ g++ /usr/bin/g++-4.4

We make sure that this is the case:

  sudo update-alternatives --config gcc

""

  update-alternatives --config gcc  (as root)


There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

* 0 /usr/bin/gcc-4.4 60 auto mode
  1 /usr/bin/gcc-4.4 60 manual mode
  2 /usr/bin/gcc-4.5 40 manual mode


  Selection    Path              Priority   Status
  ------------------------------------------------------------

Press enter to keep the current choice[*], or type selection number:
""

Suricata

Enter the following in your download directory:

  git clone git://phalanx.openinfosecfoundation.org/oisf.git
  cd oisf/
  ./autogen.sh
  ./configure --enable-gccprotect --enable-profiling --enable-cuda \
  --with-cuda-includes=/usr/local/cuda/include --with-cuda-libraries=/usr/
  local/cuda/lib64/

After that you should get the following result:
""

  Suricata Configuration:
    NFQueue support:          no
    IPFW support:             no
    PF_RING support:          no
    Prelude support:          no
    Unit tests enabled:       no
    Debug output enabled:     no
    Debug validation enabled: no
    CUDA enabled:             yes
    DAG enabled:              no
    Profiling enabled:        yes
    GCC Protect enabled:      yes
    GCC march native enabled: yes
    GCC Profile enabled:      no
    Unified native time:      no
    Non-bundled htp:          no
    PCRE sljit:               no
  ""


  make && make install
  ldconfig

Proceed with Basic_Setup
After you start suricata , you should see cuda

  example :
  ""
  suricata -c suricata.yaml -i eth0
  [12406] 13/8/2011 -- 10:14:39 - (suricata.c:622) <Info> (main) -- This is
  Suricata version 1.1beta2 (rev b3f7e6a)
  [12406] 13/8/2011 -- 10:14:39 - (util-cpu.c:171) <Info> (UtilCpuPrintSummary)
  -- CPUs/cores online: 8
  [12406] 13/8/2011 -- 10:14:39 - (util-cuda.c:4504) <Info>
  (SCCudaPrintBasicDeviceInfo) -- GPU Device 1: GeForce 310M, 2
  Multiprocessors, 1468MHz, CUDA Compute Capability 1.2...................
  ........................
  ""

