とんちゃんといっしょ

Cloudに関する技術とか日常とかについて書いたり書かなかったり

Redmine初期設定メモ

Redmineを入れようとするとエラーが出る。

# rake db:migrate RAILS_ENV=production
(in /root/file/redmine-0.8.4)
rake aborted!
could not connect to server: Connection refused
        Is the server running on host "localhost" and accepting
        TCP/IP connections on port 5432?

(See full trace by running task with --trace)


どうもpostgresがうまく立ち上がっていないようなので手動で起動させてみる。

# /etc/init.d/postgresql start

/var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize the cluster first.
                                                           [FAILED]

initdbしてないぞコンチクショウって怒られた。
じゃあinitdbしに行こうということでユーザをpostgresに変更。
文字コードUTF-8
あとpostgresのバージョンが8.3.7なので--no-localeオプションは必須

# su - postgres
$ initdb  --encoding=UTF-8 --no-locale
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default text search configuration will be set to "english".

fixing permissions on existing directory /var/lib/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers/max_fsm_pages ... 24MB/153600
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    postgres -D /var/lib/pgsql/data
or
    pg_ctl -D /var/lib/pgsql/data -l logfile start

これで成功らしい。
createdbでredmineのDBを作成しておいてから脱出。
postgresを立ち上げて再度rakeを実行。

$ createdb redmine
$ exit
logout
# /etc/init.d/postgresql start
Starting postgresql service:                               [  OK  ]
# rake db:migrate RAILS_ENV=production

〜〜省略〜〜
== 100 AddChangesetsUserId: migrating =========================================
    • add_column(:changesets, :user_id, :integer, {:default=>nil})
-> 0.0023s == 100 AddChangesetsUserId: migrated (0.0025s) ================================ == 101 PopulateChangesetsUserId: migrating ==================================== == 101 PopulateChangesetsUserId: migrated (0.0008s) ===========================

これで成功らしい。

次にデフォルトのデータを設定ここはjaつまり日本語。

# rake load_default_data RAILS_ENV=production
(in /root/file/redmine-0.8.4)

Select language: bg, ca, cs, da, de, en, es, fi, fr, he, hu, it, ja, ko, lt, nl, no, pl, pt, pt-br, ro, ru, sk, sr, sv, th, tr, uk, vn, zh, zh-tw [en] ja
====================================
Default configuration data loaded.

Note: The rake task load_default_data has been deprecated, please use the replacement version redmine:load_default_data


あとは起動してつなげて設定するだけ。
動いた動いた。


参照:
Redmineのインストール — Redmine.JP
PostgreSQLの管理 | Netsphere Laboratories