Subscribe to the RSS Feed or Atom Feed

地には血がない、違いない

Neko Nyan Liberation

Serving up both kinds of moe

"In depth" guide on installing danbooru on freebsd

Posted Dec 24, 04:13 AM by dovac

This was mostly for myself in case I ever needed to do a fresh install of danbooru on freebsd, so lets get started

Something to note, I used vmware to run danbooru instead of an actual machine.

Download: ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/6.2/6.2-RELEASE-amd64-bootonly.iso
(or whatever arch you’re on)

Do your basic install, use the minimal install profile. I won’t walk though how to set that up since I’m sure you can google the information

Make sure the ports tree is up to date, its quite important to have the “latest” packages.

List of things to install:

cd /usr/ports/devel/mkmf/ && make install clean
cd /usr/ports/ftp/wget/ && make install clean
cd /usr/ports/editors/nano/ && make install clean
cd /usr/ports/devel/subversion/ && make install clean
Subversion will ask for options about libiconv, just chose ok, and for python25 disable ipv6 and enable huge stack size.

cd /usr/ports/databases/memcached/ && make install clean
cd /usr/ports/graphics/gd/ && make install clean
In GD make sure you enable iconv support

This does not apply now, ports is updated to postgres 8.3rc1

Now here’s the tricky part installing postgres 8.3 beta. On the ports tree there’s only beta2, but you can’t get that off postgres’s site since they’re up to beta4.

Anyways navigate to:
/usr/ports/databases/postgresql83-server/

Edit the Makefile, remove BROKEN= Unfetchable”

Then download:
http://public.www.planetmirror.com/pub/postgresql/source/v8.3beta2/postgresql-base-8.3beta2.tar.bz2
http://public.www.planetmirror.com/pub/postgresql/source/v8.3beta2/postgresql-opt-8.3beta2.tar.bz2
to /usr/ports/distfiles/postgresql

Hopefully when the ports tree gets updated this step won’t be needed. Now you can compile postgresql
End of This does not apply now

cd /usr/ports/databases/postgresql83-client/ && make install clean
cd /usr/ports/databases/postgresql83-server/ && make install clean

Just use the defaults when compiling.

Now we have to add the 2 new services in to our /etc/rc.conf
Put in:
postgresql_enable=“YES
memcached_enable=“yes”
memcached_flags=”-l 127.0.0.1 -d -m 100”
and save.

First you’ll need to create the base postgres database, use /usr/local/etc/rc.d/postgresql initdb
Then start up postgres

Now we have to install ruby and rails.

cd /usr/ports/lang/ruby18/ && make install clean
Disable ipv6

cd /usr/ports/www/rubygem-rails/ && make install clean
Something to note, make sure its rubygem-rails-1.2.6. Rails 2.0 breaks danbooru so don’t use it. Enable fcgi and memcache client.

cd /usr/ports/www/rubygem-redcloth/ && make install clean
cd /usr/ports/www/rubygem-mongrel/ && make install clean

Not all gems are available from ports.

Download: http://rubyforge.org/frs/download.php/29624/postgres-0.7.9.2007.12.22.gem
Run: gem install —no-ri —install-dir /usr/local/lib/ruby/gems/1.8 /where/you/downloaded/the/gem
After run:
gem install aws-s3 diff-lcs acts_as_versioned html5
and choose y to all dependencies.

Finally, danbooru install:

run adduser, make a danbooru user and set a password

cd /home/danbooru
svn co svn://danbooru.donmai.us/danbooru/trunk
cd trunk/
mv * ..
cd ..
rm -r trunk/

Import danbooru db:

su pgsql
psql template1
now you’re in postgres terminal
CREATE DATABASE danbooru;
\q
psql -d danbooru -f /home/danbooru/db/postgres.sql

Now to configure danbooru:

exit out of pgsql user
Go back to the danbooru config directory and edit:

database.yml.example
edit username: to pgsql on all areas
Then move database.yml.example to database.yml

edit: local_config.rb.example
change to how you like
add in:
CONFIG[“password_salt”] = “choujin-steiner” <—replace the salt with something else
CONFIG[“image_store”] = :local_flat <—replace with :local_hierarchy
CONFIG[“enable_caching”] = false <—change to true
CONFIG[“memcache_servers”] = [“localhost:4000”] <—change to “localhost:11211”

Move local_config.rb.example to local_config.rb

Now you have to compile the resizer go to lib/danbooru_image_resizer/

Run:
ruby extconf.rb
Then:
cp /usr/local/include/gd.h gd.h
cp /usr/local/include/gd_io.h gd_io.h
cp /usr/local/include/gdfx.h gdfx.h
Now compile it, go back to the danbooru directory and run:
/usr/local/bin/rake db:migrate

Now you have the environment set for danbooru. Start up memcached then mongrel_rails. By default mongrel has the webserver port on port 3000, its up to you to figure out the config. Enjoy :x Feel free to comment if you need help I guess.


Comments

  1. Dec 24, 07:05 AM

    edogawaconan Says:

    now I need help in upgrading danbooru… :S

  2. Dec 24, 07:37 AM

    tskiller Says:

    BSD gives me brain cancer. And this is coming from someone who doesn’t mind doing stage 1 gentoo installs.

  3. Dec 24, 04:31 PM

    edogawaconan Says:

    GNU/Linux gives me brain cancer. And this is coming from someone who doesn’t mind building FreeBSD-stable.

  4. Dec 24, 08:33 PM

    dovac Says:

    1 > upgrading from what version of danbooru?

  5. Dec 25, 04:27 AM

    edogawaconan Says:

    1.10 to 1.11. does the imageresizer need to be recompiled? and is there any database need updating? :S

  6. Dec 25, 08:39 PM

    dovac Says:

    5> 1.11 is still in branch its not a full release yet maybe you should wait till its tagged as 1.11 in svn? Anyways to upgrade danbooru just replace the files and run rake db:migrate, and it should work, but if you customized the style sheets and stuff don’t overwrite those.

  7. Jan 1, 09:59 AM

    edogawaconan Says:

    1.11 was tagged 5 days ago btw :)

    I have some more questions:

    - how do i use gd that was compiled to non-default location (ie /usr/local/gd/) when making resizer?

    - is it safe to modify config file after running danbooru for few months and has hundreds of images in it?

    - is load balancing needed?

    - is moving danbooru to other server only involves moving danbooru folder and reinserting database? (with same server config)

  8. Jan 1, 10:36 AM

    edogawaconan Says:

    just remembered one more question:
    how do i set up database with user account other than root for danbooru? my last attempt results in permission denied when running migrate script (even though I already give full database permission to the user)

  9. Jan 1, 11:42 AM

    edogawaconan Says:

    LOL one more.
    how do i turn off forum functionality?

  10. Jan 2, 04:25 AM

    dovac Says:

    7>
    a) Just copy the missing .h files
    b) Depends on what you’re doing, if you’re switching to a local hierarchy you’ll have to move the files around yourself
    c) No, only if you’re getting a ton of traffic
    d) Yes, for the most part
    8>
    You’ll need to create a user called root
    9>
    There should be a option in default_config.rb, or at least it used to, if not just delete the link in /static/more.rhtml and /layouts/*.rhtml

  11. Jan 3, 04:43 AM

    edogawaconan Says:

    > b) Depends on what you’re doing, if you’re switching to a local hierarchy you’ll have to move the files around yourself
    …looks like trouble o_oa
    but changing other settings like url or memcache is no problem, right?

    > You’ll need to create a user called root
    so basically just use “root” instead of “pgsql” for the root account and then make another non-root account for danbooru database? :S

  12. Jan 3, 11:33 PM

    dovac Says:

    11>
    a) yeah no issues
    b) huh?, there’s no “root” role/user in default install of postgres on freebsd, you can use pgsql as the user, i.e. su pgsql after you su’ed to root.

  13. Jan 5, 09:53 AM

    edogawaconan Says:

    >> a) Just copy the missing .h files
    just tried today, actually all I need is do this: (gd is installed in /usr/local/gd)
    ruby extconf.rb —with-gd-dir=/usr/local/gd

    and my upgrade process ran smoothly (to 1.12.0-current) :)

  14. Jan 6, 12:09 AM

    dovac Says:

    Thats good to hear, hope you ran the migration script if needed

  15. May 14, 11:39 AM

    ktulhu89 Says:

    have problems with html5 gem (both available versions 0.1.0 and 0.10.0)
    /home/ktulhu/gems/gems/html5-0.10.0/lib/html5/inputstream.rb:305: too short multibyte code string: /^ ( [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 )/

Leave a Comment!

Add your comment. Preview then Submit.


Hidden


Textile Help