Skip to content

Ubuntu 1.9.2 without RVM by Eric Peters

cvandeplas edited this page Feb 9, 2012 · 29 revisions

Let’s install Ruby 1.9.2 and Rails 3 stable on Ubuntu. I’m going to use just one Ruby version so I'm not going to use RVM (Ruby Version Manager) and this will be built from source. This is valid for Ubuntu 10.04, 32 bit. And possibly (not tested) on 64bit and older versions.

-- Updated doc for Ubuntu 11.04, ruby 1.9.2 p290 -- jbc

We are going to need to install required files to compile Ruby

sudo apt-get install gcc g++ build-essential libssl-dev libreadline5-dev zlib1g-dev linux-headers-generic libsqlite3-dev libxslt-dev libxml2-dev imagemagick libmysqlclient-dev libmagick9-dev git-core mysql-server wkhtmltopdf git

Now download Ruby 1.9.2 sources, unpack them and install:

sudo wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
tar -xvzf ruby-1.9.2-p290.tar.gz
cd ruby-1.9.2-p290/
sudo ./configure --prefix=/usr/local/ruby && sudo make && sudo make install

Add path to binary Ruby files. You need to add in the PATH variable that path - /usr/local/ruby/bin, should look something like this:

sudo nano /etc/environment

PATH="/usr/local/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

Then run the source command for the file /etc/environment to apply changes.

source /etc/environment

Ruby 1.9.2 already includes Rubygems, so you do not have to install it.

Check that Ruby is installed properly: You should see something like this:''ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] ''

ruby -v

Now install the required gem packages, including Rails 3.:

sudo gem install tzinfo builder memcache-client rack rack-test erubis mail text-format bundler thor i18n sqlite3-ruby rdoc

sudo gem install rack-mount --version=0.4.0

sudo gem install rails --version 3.0.0

Check Rails version:

rails -v

You should see the version number 3.0.0. Otherwise, try to execute command source /etc/environment and enter rails -v command once again.


Change to the directory one-level higher than where you want to place Snorby files (i.e.: I put my instance of Snorby in /usr/local/src/). Then download the latest bleeding edge release via git.

git clone git://github.com/Snorby/snorby.git

In this case, git will now download all source code files into the directory /usr/local/src/snorby/.

Noob Comment by Praxi: I made a directory called snorby, changed to that directory, then ran the git command (with a sudo of course), git downloaded it to my directory as a directory. I ended up with /var/www/apps/snorby/snorby/

Change into the snorby directory that you just cloned from git.

cd snorby

Install Gem dependencies (we already installed bundler earlier)

bundle install

Edit the Snorby database configuration file with the correct information.

gedit config/database.yml

Edit the Snorby configuration file, this should be self explanatory.

gedit config/snorby_config.yml

Edit the Snorby mail configuration file.

gedit config/initializers/mail_config.rb

Make sure there is only one version of the i18n gem installed. We will want to remove the 0.5.0 version.

sudo gem uninstall i18n

Select gem to uninstall:
1. i18n-0.4.2
2. i18n-0.5.0
3. All versions
> 2
Successfully uninstalled i18n-0.5.0

Edit snorby/script/rails and change the first line to match your enviroment: eg..

gedit script/rails

For my enviroment I replaced the first line 

#!/usr/bin/env ruby

with

#!/usr/local/ruby/bin/ruby

Run The Snorby Setup

rake snorby:setup

Note: If you get:

$ rake snorby:setup
(in /usr/local/src/snorby)
rake aborted!
no such file to load -- openssl

I had to run:

cd ~/ruby-1.9.2-p290/ext/openssl
ruby extconf.rb
make
sudo make install

Note: If you get the following error: No such file or directory - /root/snorby/tmp/snorby_packaged_uncompressed.js Create the following directories in the Snorby root dir: log/ & tmp/

mkdir log

mkdir tmp

Note: If you get the warning "Jammit Warning: Asset compression disabled -- Java unavailable" you probably don't have a JRE installed. An easy fix is to install one.

sudo apt-get install default-jre-headless

Note: If you get the error "uninitialized constant Rake::DSL" it appears to be something that was fixed in rake version 0.9.2. Installing the more current version of rake will fix that.

sudo gem install rake --version 0.9.2

Once all options have been configured we can now try and start it up. From the base Snorby dir run:

rails s

You should now be able to log in. The default username is "snorby@snorby.org" and the default password is "snorby".

Make sure you start the Snorby Worker from the Administration page. Or if that fails to start the worker, we can start it by hand by a couple ways listed bellow.

ruby script/delayed_job start
rails runner 'Snorby::Jobs::SensorCacheJob.new(false).perform; Snorby::Jobs::DailyCacheJob.new(false).perform'

or

rails c
Loading development environment (Rails 3.0.3)
irb(main):001:0>Snorby::Worker.start
irb(main):002:0>Snorby::Jobs::SensorCacheJob.new(false).perform;
irb(main):003:0>Snorby::Jobs::DailyCacheJob.new(false).perform 

Note: If your sensor is not listed under sensors restart Snort and it should show up.

Back to Snorby E-Book