个人工具

“UbuntuHelp:Danbooru”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第2行: 第2行:
 
{{Languages|UbuntuHelp:Danbooru}}
 
{{Languages|UbuntuHelp:Danbooru}}
 
Danbooru, from the japanese for cardboard box, is a powerful image board system with tagging.
 
Danbooru, from the japanese for cardboard box, is a powerful image board system with tagging.
 
 
It is built on RubyOnRails.
 
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.
 
This HOWTO explains how to install it on a debian-like distribution; it has been tested with ubuntu 6.06 and ubuntu feisty.
 
 
==== Prerequisites ====
 
==== Prerequisites ====
 
 
Install this and more.
 
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.
 
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].
 
Note: Ensure that you have the Universe repository enabled in your /etc/sources.list. See [https://wiki.ubuntu.com/AddingRepositoriesHowto].
 
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install rails postgresql-8.1 postgresql-8.1-plruby rubygems libgd2-xpm-dev
 
sudo apt-get install rails postgresql-8.1 postgresql-8.1-plruby rubygems libgd2-xpm-dev
 
sudo gem install diff-lcs acts_as_versioned
 
sudo gem install diff-lcs acts_as_versioned
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Get the source ====
 
==== Get the source ====
 
<pre><nowiki>
 
<pre><nowiki>
第24行: 第17行:
 
cd danbooru
 
cd danbooru
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Tell it where rails is installed system-wide
 
Tell it where rails is installed system-wide
 
<pre><nowiki>
 
<pre><nowiki>
 
ln -sf /usr/share/rails vendor/
 
ln -sf /usr/share/rails vendor/
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Rebuild the image resizer binary.
 
Rebuild the image resizer binary.
 
<pre><nowiki>
 
<pre><nowiki>
第35行: 第26行:
 
make -C lib/resizer resizer
 
make -C lib/resizer resizer
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Set up the database ====
 
==== Set up the database ====
 
Create a self-contained postgresql runtime
 
Create a self-contained postgresql runtime
第48行: 第38行:
 
createuser -sDR danbooru-dbuser
 
createuser -sDR danbooru-dbuser
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Load a schema into the DB - I had some errors, but it still worked.
 
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
 
For a real life example, use the schema recently published on http://mapored.net/dump.db.bz2
 
<pre><nowiki>
 
<pre><nowiki>
 
psql danbooru-dev danbooru-dbuser -f db/postgres.sql  
 
psql danbooru-dev danbooru-dbuser -f db/postgres.sql  
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Optionally, play around with your new database
 
Optionally, play around with your new database
 
<pre><nowiki>
 
<pre><nowiki>
 
psql danbooru-dev danbooru-dbuser
 
psql danbooru-dev danbooru-dbuser
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Stop the database
 
Stop the database
 
<pre><nowiki>
 
<pre><nowiki>
 
LOCAL_DB=~+/var-db eval 'PGDATA=$LOCAL_DB/data /usr/lib/postgresql/8.1/bin/pg_ctl -w stop'
 
LOCAL_DB=~+/var-db eval 'PGDATA=$LOCAL_DB/data /usr/lib/postgresql/8.1/bin/pg_ctl -w stop'
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Write a DB config file for RubyOnRails
 
Write a DB config file for RubyOnRails
 
<pre><nowiki>
 
<pre><nowiki>
第73行: 第58行:
 
host: $PGHOST
 
host: $PGHOST
 
username: danbooru-dbuser
 
username: danbooru-dbuser
 
 
development:
 
development:
 
database: danbooru-dev
 
database: danbooru-dev
 
<<: *common
 
<<: *common
 
 
test:
 
test:
 
database: danbooru-test
 
database: danbooru-test
 
<<: *common
 
<<: *common
 
 
production:
 
production:
 
database: danbooru-prod
 
database: danbooru-prod
第87行: 第69行:
 
EOF
 
EOF
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Setup the website, and test it ====
 
==== Setup the website, and test it ====
 
Edit the website settings
 
Edit the website settings
 
 
You will probably change the e-mail address and the server address, where image and previews are found.
 
You will probably change the e-mail address and the server address, where image and previews are found.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
cp config/config_local.yml{.example,}
 
cp config/config_local.yml{.example,}
 
sensible-editor config/config_local.yml
 
sensible-editor config/config_local.yml
 
</nowiki></pre>
 
</nowiki></pre>
 
 
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
 
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><nowiki>
 
<pre><nowiki>
第103行: 第81行:
 
rake
 
rake
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Start a server ====
 
==== Start a server ====
 
 
Start a database
 
Start a database
 
<pre><nowiki>
 
<pre><nowiki>
 
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"'
 
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"'
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Start a local web server until you type Ctrl-C
 
Start a local web server until you type Ctrl-C
 
<pre><nowiki>
 
<pre><nowiki>
 
ruby script/server
 
ruby script/server
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Visit it, create the first user (who automagically becomes admin)
 
Visit it, create the first user (who automagically becomes admin)
 
<pre><nowiki>
 
<pre><nowiki>
 
sensible-browser http://localhost:3000
 
sensible-browser http://localhost:3000
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Enjoy your danbooru!
 
Enjoy your danbooru!
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月30日 (五) 16:39的版本

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

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!