特殊:Badtitle/NS100:Danbooru:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Oneleaf留言 | 贡献
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...
 
Oneleaf留言 | 贡献
无编辑摘要
第17行: 第17行:
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></code>
</nowiki></pre>


==== Get the source ====
==== Get the source ====
第23行: 第23行:
svn co svn://donmai.us/danbooru/trunk danbooru
svn co svn://donmai.us/danbooru/trunk danbooru
cd danbooru
cd danbooru
</nowiki></code>
</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></code>
</nowiki></pre>


Rebuild the image resizer binary.
Rebuild the image resizer binary.
第34行: 第34行:
rm -f lib/resizer/resizer
rm -f lib/resizer/resizer
make -C lib/resizer resizer
make -C lib/resizer resizer
</nowiki></code>
</nowiki></pre>


==== Set up the database ====
==== Set up the database ====
第47行: 第47行:
for i in dev test prod; do createdb danbooru-$i; done
for i in dev test prod; do createdb danbooru-$i; done
createuser -sDR danbooru-dbuser
createuser -sDR danbooru-dbuser
</nowiki></code>
</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.
第54行: 第54行:
<pre><nowiki>
<pre><nowiki>
psql danbooru-dev danbooru-dbuser -f db/postgres.sql  
psql danbooru-dev danbooru-dbuser -f db/postgres.sql  
</nowiki></code>
</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></code>
</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></code>
</nowiki></pre>


Write a DB config file for RubyOnRails
Write a DB config file for RubyOnRails
第86行: 第86行:
   <<: *common
   <<: *common
EOF
EOF
</nowiki></code>
</nowiki></pre>


==== Setup the website, and test it ====
==== Setup the website, and test it ====
第96行: 第96行:
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></code>
</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
第102行: 第102行:
rake test:functionals  
rake test:functionals  
rake
rake
</nowiki></code>
</nowiki></pre>


==== Start a server ====
==== Start a server ====
第109行: 第109行:
<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></code>
</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></code>
</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></code>
</nowiki></pre>


Enjoy your danbooru!
Enjoy your danbooru!


[[category:UbuntuHelp]]
[[category:UbuntuHelp]]

2007年5月13日 (日) 12:37的版本

{{#ifexist: :Danbooru/zh | | {{#ifexist: Danbooru/zh | | {{#ifeq: {{#titleparts:Danbooru|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Danbooru|1|-1|}} | zh | | }}

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!