I believe I've worked out all the kinks. This script will setup Ruby, Ruby Gems, Rails, PostgreSQL, Nginx, and Danbooru itself. I've tested it on a fresh install of Debian Lenny in VMware and had no issues, but I'd like to release it for more testing. Hopefully this script will also serve as a template for automated Fedora/FreeBSD scripts. Just download it and run as root.
In case it's not obvious, you need a decent VPS or a dedicated server for this script to work. It won't work on a shared hosting environment (I don't think).
Get it here: http://danbooru.donmai.us/pkg/INSTALL.debian
Updated by Lalaca