Danbooru is a powerful image board system which uses tagging extensively.
It is built on RubyOnRails.
This HOWTO explains how to install it on Ubuntu and other Debian-like distros; it has been tested with Ubuntu 6.06 and Ubuntu Feisty.
Prerequisites
Install this and more. There used to be a more complete list on the wiki, most of which I had already installed. Additions are welcome.
Note: Ensure that you have the Universe repository enabled in your /etc/sources.list. See https://wiki.ubuntu.com/AddingRepositoriesHowto.
sudo apt-get install rails postgresql-8.1 postgresql-8.1-plruby rubygems libgd2-xpm-dev sudo gem install diff-lcs acts_as_versioned
Get the source
svn co svn://donmai.us/danbooru/trunk danbooru cd danbooru
Tell it where rails is installed system-wide
ln -sf /usr/share/rails vendor/
Rebuild the image resizer binary.
rm -f lib/resizer/resizer make -C lib/resizer resizer
Set up the database
Create a self-contained postgresql runtime
export PATH=$PATH:/usr/lib/postgresql/8.1/bin export LOCAL_DB=$PWD/var-db export PGDATA=$LOCAL_DB/data initdb export PGHOST=$LOCAL_DB pg_ctl -w -l $LOCAL_DB/server.log start -o "-c listen_addresses= -c unix_socket_directory=$LOCAL_DB" for i in dev test prod; do createdb danbooru-$i; done createuser -sDR danbooru-dbuser
Load a schema into the DB - I had some errors, but it still worked.
For a real life example, use the schema recently published on http://mapored.net/dump.db.bz2
psql danbooru-dev danbooru-dbuser -f db/postgres.sql
Optionally, play around with your new database
psql danbooru-dev danbooru-dbuser
Stop the database
LOCAL_DB=~+/var-db eval 'PGDATA=$LOCAL_DB/data /usr/lib/postgresql/8.1/bin/pg_ctl -w stop'
Write a DB config file for RubyOnRails
cat <<EOF > config/database.yml common: &common adapter: postgresql host: $PGHOST username: danbooru-dbuser development: database: danbooru-dev <<: *common test: database: danbooru-test <<: *common production: database: danbooru-prod <<: *common EOF
Setup the website, and test it
Edit the website settings
You will probably change the e-mail address and the server address, where image and previews are found.
cp config/config_local.yml{.example,} sensible-editor config/config_local.yml
Run a few tests. Don't run just «rake» right now, you won't get meaningful error messages. First test with a specific target like test:functionals
rake test:functionals rake
Start a server
Start a database
LOCAL_DB=~+/var-db eval 'PGHOST=$LOCAL_DB PGDATA=$LOCAL_DB/data /usr/lib/postgresql/8.1/bin/pg_ctl -w -l $LOCAL_DB/server.log start -o "-c listen_addresses= -c unix_socket_directory=$LOCAL_DB"'
Start a local web server until you type Ctrl-C
ruby script/server
Visit it, create the first user (who automagically becomes admin)
sensible-browser http://localhost:3000
Enjoy your danbooru!