UbuntuHelp:Danbooru
来自Ubuntu中文
Oneleaf(讨论 | 贡献)2007年5月13日 (日) 11:27的版本 (New page: {{From|https://help.ubuntu.com/community/Danbooru}} {{Languages|php5}} Danbooru, from the japanese for cardboard box, is a powerful image board system with tagging. It is built on RubyOnR...)
Danbooru, from the japanese for cardboard box, is a powerful image board system with tagging.
It is built on RubyOnRails.
This HOWTO explains how to install it on a debian-like distribution; 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 [1].
sudo apt-get install rails postgresql-8.1 postgresql-8.1-plruby rubygems libgd2-xpm-dev sudo gem install diff-lcs acts_as_versioned </code> ==== Get the source ==== <pre> svn co svn://donmai.us/danbooru/trunk danbooru cd danbooru </code> Tell it where rails is installed system-wide <pre> ln -sf /usr/share/rails vendor/ </code> Rebuild the image resizer binary. <pre> rm -f lib/resizer/resizer make -C lib/resizer resizer </code> ==== Set up the database ==== Create a self-contained postgresql runtime <pre> 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 </code> 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 <pre> psql danbooru-dev danbooru-dbuser -f db/postgres.sql </code> Optionally, play around with your new database <pre> psql danbooru-dev danbooru-dbuser </code> Stop the database <pre> LOCAL_DB=~+/var-db eval 'PGDATA=$LOCAL_DB/data /usr/lib/postgresql/8.1/bin/pg_ctl -w stop' </code> Write a DB config file for RubyOnRails <pre> 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 </code> ==== 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. <pre> cp config/config_local.yml{.example,} sensible-editor config/config_local.yml </code> 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 <pre> rake test:functionals rake </code> ==== Start a server ==== Start a database <pre> 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"' </code> Start a local web server until you type Ctrl-C <pre> ruby script/server </code> Visit it, create the first user (who automagically becomes admin) <pre> sensible-browser http://localhost:3000 </code> Enjoy your danbooru! [[category:UbuntuHelp]]