Redmineインストール

インストール手順はHowTo Install Redmine in Ubuntu - Redmineにありました。

ともかくインストール

 $ sudo apt-get install libapache2-mod-passenger
 $ sudo apt-get install redmine redmine-mysql

インストールの最後にメッセージが表示される

 ┌───────────────────────────────────────────┤ redmine を設定しています ├────────────────────────────────────────────┐  
 │                                                                                                                   │  
 │ redmine/instances/default は利用できるようになる前にはデータベースをインストールして設定する必要があります。この     
 │ 設定を dbconfig-common で管理するようにもできます。                                                                  
 │                                                                                                                      
 │ あなたが熟練したデータベース管理者でこの設定について手動で何をするのかを知っている場合、あるいはデータベースが既     
 │ にインストール及び設定されている場合は、この選択を選ばない方が良いでしょう。何をすればいいのかについての詳細につ     
 │ いては、大抵 /usr/share/doc/redmine/instances/default に置かれています。                                             
 │                                                                                                                      
 │                                                      <了解>                                                          
 │                                                                                                                   │  
 └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

了解を押すと

                    ┌────────────────────────┤ redmine を設定しています ├─────────────────────────┐                     
                    │                                                                             │                     
                    │ redmine/instances/default のデータベースを dbconfig-common で設定しますか?  │                     
                    │                                                                             │                     
                    │                     <はい>                       <いいえ>                   │                     
                    │                                                                             │                     
                    └─────────────────────────────────────────────────────────────────────────────┘

# 何を思ったのか「いいえ」を選んだ。ここで「はい」を選べばもっと楽だったのかも。


シンボリックリンクを張る

 $ sudo ln -s /usr/share/redmine/public /var/www/redmine

/etc/apache2/mods-available/passenger.confを下記のように編集(PassengerDefaultUserを追加)


  PassengerRoot /usr
  PassengerRuby /usr/bin/ruby
  PassengerDefaultUser www-data

Apache再起動

 $ sudo service apache2 restart

ここで、http://サーバアドレス/redmineにアクセスするとエラー画面が表示された。
「No such file or directory - /etc/redmine/default/database.yml」とのこと。
/usr/share/redmine/templates/database.yml.templateにひな形っぽいファイルがあるので、
これをConfigurationの章を参考に編集して/etc/redmine/default/database.ymlとして保存する。(my_passwordは適当)

production:
  adapter: mysql
  database: redmine
  host: localhost
  port: 3306
  username: redmine
  password: my_password
  encoding: utf8

再度アクセスするも、エラー表示。今度は「Unknown database 'redmine' (Mysql::Error)」。



ないなら作ろうということで

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 47
Server version: 5.5.22-0ubuntu1 (Ubuntu)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database redmine;
Query OK, 1 row affected (0.00 sec)

mysql> create user 'redmine'@'localhost' identified by 'my_password';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye


再度エラー表示。
ログを確認しろと書いてあったので/var/log/redmine/default/production.logを確認。

 Processing WelcomeController#index (for ***.***.***.*** at 2012-05-03 00:32:35) [GET]
   Parameters: {"action"=>"index", "controller"=>"welcome"}
 
 ActiveRecord::StatementInvalid (Mysql::Error: Table 'redmine.settings' doesn't exist: SHOW FIELDS FROM `settings`):

テーブルがないらしい。


手順の下の方に「Create the database structure, by running the following command under the application root directory (I mean “/opt/redmine/redmine-0.8.6”):」の記載があったのでこれを試してみる。

 $ cd /usr/share/redmine
 $ sudo rake db:migrate RAILS_ENV="production"
 $ sudo rake redmine:load_default_data RAILS_ENV="production"

言語を選択する表示が出るので、jaを選択。

なにやら全然分かっていないけど取りあえず動いた。
最初に「はい」を選択しておけばそれだけですんだのかも?

デフォルトの管理者アカウントは、ID/PASSともにadminとなっているようだ。