Snorby in CentOS 6.5

snorby_newHi, this is me again. This time I’m offering an update of my old post about how to install Snorby on CentOS as some readers have found some errors and problems. Though I’ve created this post for CentOS 6.5, this article may help you also if you’re trying to install Snorby on CentOS 6.4.

Now it’s easier to use wkhtmltopdf and I’ve also added a section to make the installation of ruby cleaner. Ok let’s start!

First, we’re installing some packages and we’re also going to install the EPEL repository.

yum install
yum groupinstall "Development Tools"
yum install openssl-devel readline-devel libxml2-devel libxslt-devel mysql mysql-devel mysql-libs mysql-server urw-fonts libX11-devel libXext-devel fontconfig-devel libXrender-devel unzip wget xorg-x11-server-Xvfb libyaml libyaml-devel gdbm-devel tcl-devel db4-devel libffi-devel 

Now we are going to download and compile ImageMagick.

cd /opt
tar xvfz ImageMagick.tar.gz
cd ImageMagick-*
make install
ldconfig /usr/local/lib

OK, time for wkhtmltopdf. In the past I had problems with the static version, that’s why I decided to compile it. The latest version works fine for me. Visit and download the latest wkhtmltopdf for your Linux architecture 32 bits or 64 bits. I’m using the 64 bits version.

cd /opt
tar xvf wkhtmltox-linux-amd64_0.12.0-03c001d.tar.xz
ln -s /opt/wkhtmltox/lib/ /usr/local/lib64/
ln -s /opt/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
ldconfig /usr/local/lib64

Thanks to this article I’ve used the instructions to create the rpm package for Ruby 1.9.3

cd /root
wget -P rpmbuild/SOURCES
wget -P rpmbuild/SPECS
rpmbuild -bb rpmbuild/SPECS/ruby19.spec
yum localinstall /root/rpmbuild/RPMS/x86_64/ruby-1.9.3p484-1.el6.x86_64.rpm

Now we’re going to install bundler and Snorby

cd /opt
gem install bundler
wget -O --no-check-certificate
cd snorby-master

I’ve created an empty database for Snorby and I’ve configured a user with permissions for that database:

# mysql -u root -p 
Enter password: 
mysql> create database snorby; 
Query OK, 1 row affected (0.14 sec) 
mysql> grant all privileges on snorby.* to snorby@localhost identified by 'snorby'; 
Query OK, 0 rows affected (0.06 sec) 

We’ve to create a database.yml config file and edit it. We’ll add the database password, the name of the database and the MySQL server hostname or IP address:

cp config/database.yml.example config/database.yml

//This is the content of my file
snorby: &snorby 
 adapter: mysql 
 username: snorby 
 password: "snorby" 
 host: localhost

OK, I hope you’re following and you’ve no errors so far. Edit the Gemfile file and follow these instructions:

Change: gem 'rake', '0.9.2' to gem 'rake', '> 0.9.2' 
Add: gem 'thin' after gem 'json' so it shows like this:
gem 'json', '~> 1.7' 
gem 'thin' 
Comment the gem 'thin' line inside the group(:development) using a #. The files will look like this:

group(:development) do 
        gem "letter_opener" 
#  gem 'thin' 

Add: gem 'orm_adapter' after gem 'netaddr' so it shows like this:
gem 'netaddr','~> 1.5.0' 
gem 'orm_adapter'

We’re close. Edit the Gemfile.lock file.

Change the line rake (0.9.2) to rake (

We need a snorby_config.yml. Then you can edit thing like the domain for your Snorby installation. You have more information about configuration in Snorby’s official page.

cp config/snorby_config.yml.example config/snorby_config.yml

Let’s install Snorby. If installation is successful we’ll launch it using the thin server (thanks for the tip Mephux and of course thank you for Snorby)

bundle install
rake snorby:setup
rails server thin -e production

If everything is fine you’ll have Snorby listening on, if you want to open the port use this iptables rule (adjust it for your needs of course 🙂 )

iptables -I INPUT -p tcp --dport 3000 -m state --state=NEW,ESTABLISHED,RELATED -j ACCEPT

And that’s it! Snorby is showing the login (user: password: snorby) and the export to PDF function is working for me. I’ll try to offer more information about Snorby in the future.

Thank you Parvez and W.White for your comments and please let me know if you find errors.