Hi, 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 http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 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 wget http://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/ImageMagick.tar.gz tar xvfz ImageMagick.tar.gz cd ImageMagick-* ./configure make 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 http://wkhtmltopdf.org/ and download the latest wkhtmltopdf for your Linux architecture 32 bits or 64 bits. I’m using the 64 bits version.
cd /opt wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.0/wkhtmltox-linux-amd64_0.12.0-03c001d.tar.xz tar xvf wkhtmltox-linux-amd64_0.12.0-03c001d.tar.xz ln -s /opt/wkhtmltox/lib/libwkhtmltox.so.0 /usr/local/lib64/libwkhtmltox.so.0 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 mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz -P rpmbuild/SOURCES wget https://raw.github.com/imeyer/ruby-1.9.3-rpm/master/ruby19.spec -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 snorby.zip --no-check-certificate https://github.com/Snorby/snorby/archive/master.zip unzip snorby.zip 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) exit
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' end 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 (0.9.2.2)
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 0.0.0.0:3000, 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: snorby@snorby.org 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.
Cheers!
Thank me for my comment…..No, thank you for writing this awesome article. I can login the interface. I still have to configure Barnyard2 on my pfSense to write to the MySQL DB but just the fact that I can get the packages installed and login successfully on the first go around totally made my day. Much appreciated!!! I’ll keep you posted when I have my setup totally configured or if I need to pick your brain.
LikeLike
Great news indeed! I hope your events will be shown soon, if I can help you anyway just let me now.
Cheers!
LikeLike
hi admin
when I run bundle install see this error
Bundler::GemspecError: Could not read gem at /usr/lib64/ruby/gems/1.9.1/cache/selenium-webdriver-2.31.0.gem. It may be corrupted.
An error occurred while installing selenium-webdriver (2.31.0), and Bundler cannot continue.
Make sure that `gem install selenium-webdriver -v ‘2.31.0’` succeeds before bundling.
LikeLike
Hi,
I know little about Ruby, sorry. Have you tried to execute the suggested command: gem install selenium-webdriver -v ‘2.31.0’? Maybe it’s just a problem with the ruby version, did you install the version I suggested in the post?
Cheers
LikeLike
After modifying the Snorby Gemfile, Gemfile.lock, config/snorby_config.yml, and config/database.yml files, When I run bundle install I get
fatal: HTTP request failed
Retrying git clone ‘https://github.com/Snorby/snorby_cas_authenticatable.git’ “/usr/local/lib/ruby/gems/1.9.1/cache/bundler/git/snorby_cas_authenticatable-4d557bf2e5955e3502ea202f9a5172c903186bff” –bare –no-hardlinks due to error (2/3): Bundler::Source::Git::GitCommandError Git error: command `git clone ‘https://github.com/Snorby/snorby_cas_authenticatable.git’ “/usr/local/lib/ruby/gems/1.9.1/cache/bundler/git/snorby_cas_authenticatable-4d557bf2e5955e3502ea202f9a5172c903186bff” –bare –no-hardlinks` in directory /opt/snorby-master has failed.
Thanks,
Ed
LikeLike
Hi,
I assume you’re trying to use the git version of Snorby, is that right? I’ve tried to execute the following command: git clone https://github.com/Snorby/snorby_cas_authenticatable.git and I can clone the github repository, maybe were you facing a network connection problem temporarily?
If you are following my steps and you’re using the Snorby stable version check if there’s a typo in the Gemfile, Gemfile.lock, config/snorby_config.yml, or config/database.yml. If you still have problems let me know and I’d try to send you my files…
I’m sorry you’re facing problems,
Cheers
LikeLike
if I try the –deployment flag…….
bundle install –deployment
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* source: https://github.com/Snorby/delayed_job_data_mapper.git (at master)
* source: https://github.com/mephux/ezprint.git (at rails3)
* source: https://github.com/Snorby/snorby_cas_authenticatable.git (at master)
* rake (> 0.9.2)
* orm_adapter
You have deleted from the Gemfile:
* source: http://github.com/Snorby/delayed_job_data_mapper.git (at master)
* source: http://github.com/Snorby/snorby_cas_authenticatable.git (at master)
* source: http://github.com/mephux/ezprint.git (at rails3)
* rake (= 0.9.2)
You have changed in the Gemfile:
* devise_cas_authenticatable from `https://github.com/Snorby/snorby_cas_authenticatable.git (at master)` to `no specified source`
* ezprint from `https://github.com/mephux/ezprint.git (at rails3)` to `no specified source`
* delayed_job_data_mapper from `https://github.com/Snorby/delayed_job_data_mapper.git (at master)` to `no specified source`
I don’t really know Ruby, so I’m not sure how to trouble shoot. What did I do wrong?
Thanks,
Ed
LikeLike
Works without any problem.
Thank you!
LikeLike
Instructions still good
LikeLike
when i run “rake snorby:setup” i get “syck has been removed, psych is used instead
Snorby requires Ruby version 1.9.x
We suggest using Ruby Version Manager (RVM) https://rvm.io/ to install the newest release”
plz help
LikeLike
Hi,
You don’t need to compile ruby 1.9.3, you can use the Software Collection repository provided from CentOS : it already contains ruby 1.9.3. It will install ruby in /opt/rh/xxx (and leave your ruby 1.8.7 untouched), and whenever you want to use it you do “scl enable ruby193” and bam, you have ruby 1.9.3.
http://dev.centos.org/centos/6/SCL/
http://wiki.centos.org/AdditionalResources/Repositories/SCL
Cheers,
tpouzet
LikeLike
Thanks for your feedback!
LikeLike
thanks…it works
LikeLike
Hi,
Great post ! Do you think you can also add the 32bit instructions for the wkhtmltopdf installation ?
LikeLike
Hi Admin
when I run this command(rpmbuild -bb rpmbuild/SPECS/ruby19.spec) see this error in rpmbuild “error: File /root/rpmbuild/SOURCES/ruby-1.9.3-p545.tar.gz: No such file or directory”
LikeLike
I solved My problem.
LikeLike
It works fine on CentOS 7.
I’ve just replaced MySQL by MariaDB.
yum -y install mariadb mariadb-devel mariadb-libs mariadb-server
systemctl start mariadb
systemctl enable mariadb
Thank you so much !
LikeLike
No, thank you for keeping this post useful!
LikeLike