Generic Danbooru INSTALL documentation

After completing this (so-called) guide, I found that it’s too long and too FreeBSD-specifics.

So I decided to write a more generic documentation. This page is generalization from previous guide. And this article is:

  • Much more informative than current INSTALL
  • Translated version of INSTALL.debian (with exception for mongrel etc)
  • Simplified edition of my previous guide
  • Much like older version of INSTALL which was rather informative but for some reason get extra-simplified to the degree not informative at all (except for pointing to INSTALL.debian)

This documentation assumes you will be using Unicorn and nginx.

Software Requirement

  • GD image processing library
  • PostgreSQL >= 8.3 + contrib
  • memcached (optional)
  • Ruby
  • Ruby Gems, with following gems:
    • pg
    • daemons
    • diff-lcs
    • html5
    • memcache-client
    • json
    • rails (version 2.3.4)
    • aws-s3
    • mechanize
    • system_timer
    • sys-cpu
    • unicorn
  • Subversion
  • nginx
  • gcc

Misc Requirement

  • A domain name for danbooru (it won’t install on folder, ie. www.mydomain.com/danbooru)
  • Several megabytes of RAM
  • Full root control (maybe not needed but it’s much easier installing as root)
  • Free time
  • Etc

Installation

  1. Ensure all the requirements are installed.
  2. Initialize new database for Danbooru. Login to postgresql as superuser (with psql):
    # create database [database_name];
    # create user [username] with password '[password]';
    # alter database [database_name] owner to [username];
  3. Create new user for Danbooru installation.
  4. Fetch latest Danbooru source (svn://donmai.us/danbooru/trunk).
  5. Create and edit configuration files (local_config.rb and database.yml) accordingly. Additional configuration options is at default_config.rb but any modification should be done at local_config.rb as it’ll override any parameters in default_config.rb. Don’t forget to set CONFIG["session_secret_key"].
  6. Don’t forget to create folder public/data/sample if you enable sample creation.
  7. Compile image resizer library at lib/danbooru_image_resizer (ruby extconf.rb && make) but do not make install it
  8. Create and install initial database. Run script scripts/db-init.sh and then import initial database at db/postgres.sql (run > psql -U [username] -f db/postgres.sql -d [database_name])
  9. Run db migration script, with environment setting RAILS_ENV=production, by doing rake db:migrate from Danbooru root folder.
  10. Test installation by running > unicorn_rails and check if it runs fine at [server_ip]:8080 from a browser. If it runs fine you can start the daemon by configuring unicorn (port – whatever unused – higher than 2000, ip address – 127.0.0.1, etc).
  11. Configure nginx to proxy to unicorn_rails. Add this server block:
    server {
      listen 80;
      server_name [domain_name];
      location ~ /.svn { deny all; }
      location / {
        root /path/to/danbooru/public;
        try_files $uri /maintenance.html @danbooru;
        client_max_body_size [maximum_upload_size]m;
        expires max;
      }
      location @danbooru {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://127.0.0.1:[unicorn_port];
      }
    }
  12. Start nginx, ensure everything works and create the first (admin) account

Much simpler than previous guide (well, this is not a guide, this is documentation – or so I hope). The previous guide was intended mainly for my own usage anyway 😛

As usual, corrections etc are welcome.

2008-09-17: minor update (regarding session key config).

2010-01-16: update yaaay.

16 thoughts on “Generic Danbooru INSTALL documentation

  1. Hi! Ok, this whole danbooru stuff has really confused me, your guide seems simple enough though, so thanks 🙂

    There is one thing, so you know where i can get super red cloth, as the source above does not work 🙁

    Would appreciate any help! 🙂

  2. Do you know of any up to date guides, I am having trouble installing it and cant seem to find any guides 🙁

    Would be much appreciated.

  3. Thanks! 🙂

    the first problem I have is that when i try to do “ruby extconf.rb && make”

    It says “make: Nothing to be done for `all’.” when it does the make!

    Nothing seems to work lol

  4. At that moment its Ubuntu, it was debian but I decided to give it a try on my server that had a fresh install of Ubuntu (server) on.

    Ruby output is:

    checking for gd.h… yes
    checking for main() in -lgd… yes
    checking for main() in -ljpeg… yes
    checking for main() in -lpng… yes
    checking for gdImageCreateFromGif() in gd.h… yes
    checking for gdImageJpeg() in gd.h… yes
    checking for jpeg_set_quality() in stdlib.h,stdio.h,jpeglib-extern.h… yes
    checking for png_set_expand_gray_1_2_4_to_8() in png.h… yes
    creating Makefile

    Then if I type make it just says:
    make: Nothing to be done for `all’.

  5. Yeah, that worked! I reinstalled it again as there was a problem with the hard drive in the server.

    I have followed all the instructions again but this time the ruby output was differnt, in a bad way. Rather than everything being yes it was no 🙁

    checking for gd.h… no
    checking for main() in -lgd… no
    checking for main() in -ljpeg… no
    checking for main() in -lpng… no
    checking for gdImageCreateFromGif() in gd.h… no
    checking for gdImageJpeg() in gd.h… no
    checking for jpeg_set_quality() in stdlib.h,stdio.h,jpeglib-extern.h… no
    checking for png_set_expand_gray_1_2_4_to_8() in png.h… no
    creating Makefile

    Any idea why??

    Sorry to keep bothering you! DX

  6. Thanks for your help but I just gave up. Somone pointed me in the direction of “naranai” and am now using that! (nekochan.aporcupine.com)

    Thanks for your help anyway 🙂

  7. Hi,
    I was wondering, when are you going to make a new guide? Since I’m having trouble installing Danbooru with Apache and stuff.

    Apothem

  8. Pingback: Danbooru install guide updated | animeBSD

  9. You, my friend, were my guiding in the horrid INSTALLDOC darkness, thanks to you, i have completed one of my life goals, thank you. OH AND QUICK NOTE TO ALL, USE RUBY 1.4.0 AND BASE DEBIAN FOR NO HEAD PAIN!

  10. Pingback: Danbooru install guide updated | Blog.myconan

Leave a Reply

Your email address will not be published. Required fields are marked *