tirsdag 4. desember 2012

Ruby and Yara on Debian environment

I am currently working on a yara project in ruby, and i just wanted to do a quick documentation on how to install yara to use with ruby on a debian environment. This post assumes you have a working ruby installation on your system.

Requirements

Repository

  • G++ & pcre library
  • Build Essentials
  • G++
  • Libpcre3
  • Libpcre3-dev

sudo apt-get install build-essentials g++ libpcre3 libpcre3-dev

Yara

Go to Yara project site and download yara source code, extract and compile it. (currently it is at version 1.6.)
cd yara-source/
./configure && make && sudo make install

Installation

Yara ruby-gem

sudo gem install yara

I then tried to load the library in IRB but ended up with this error 
irb(main):001:0> require 'yara'
LoadError: libyara.so.0: cannot open shared object file: No such file or directory - /var/lib/gems/1.9.1/gems/yara-1.6.0/lib/yara_native.so
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /var/lib/gems/1.9.1/gems/yara-1.6.0/lib/yara.rb:18:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:33:in `require'
from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from (irb):1
from /usr/bin/irb1.9.1:12:in `<main>'


Library problems


libyara.so.0 is located in /usr/local/lib/libyara.so.0. To fix this added path to /etc/ld.so.conf and ran ldconfig
sudo sh -c "echo '/usr/local/lib' >> /etc/ld.so.conf" && sudo ldconfig


Ingen kommentarer:

Legg inn en kommentar