「Redmine」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(同期)
(3人の利用者による、間の23版が非表示)
1行目: 1行目:
[[Category:バージョン管理システム]]
+
[[Category:課題追跡システム]]
 
[[en:Redmine]]
 
[[en:Redmine]]
 
{{Related articles start}}
 
{{Related articles start}}
8行目: 8行目:
 
{{Related|Nginx}}
 
{{Related|Nginx}}
 
{{Related articles end}}
 
{{Related articles end}}
'''Redmine''' は[[Wikipedia:free and open source software|フリーかつオープンソース]]の、ウェブベースの[[Wikipedia:project management|プロジェクト管理]]・[[Wikipedia:Issue tracking system|課題管理]]ツールです。複数のプロジェクト・サブプロジェクトを扱うことができます。[http://www.redmine.org/projects/redmine/wiki/Features 機能] としてプロジェクト wiki やフォーラム、時間管理、柔軟なロールベースのアクセス制御があります。[[Wikipedia:calendar|カレンダー]]や[[Wikipedia:Gantt chart|ガントチャート]]も搭載しており、プロジェクトの[[Wikipedia:time limit|デッドライン]]を視覚的に把握できます。Redmine は様々な[[Wikipedia:version control|バージョン管理]]システムと統合できるように、リポジトリブラウザや差分ビューアを内蔵しています。
+
[https://www.redmine.org/ Redmine] は[[Wikipedia:free and open source software|フリーかつオープンソース]]の、ウェブベースの[[Wikipedia:project management|プロジェクト管理]]・[[Wikipedia:Issue tracking system|課題追跡]]ツールです。複数のプロジェクト・サブプロジェクトを扱うことができます。[http://www.redmine.org/projects/redmine/wiki/Features 機能] としてプロジェクト wiki やフォーラム、時間管理、柔軟なロールベースのアクセス制御があります。[[Wikipedia:calendar|カレンダー]]や[[Wikipedia:Gantt chart|ガントチャート]]も搭載しており、プロジェクトの[[Wikipedia:time limit|デッドライン]]を視覚的に把握できます。Redmine は様々な[[Wikipedia:version control|バージョン管理]]システムと統合できるように、リポジトリブラウザや差分ビューアを内蔵しています。
   
Redmine は [[Ruby on Rails]] フレームワークを使用して書かれています。クロスプラットフォームで動作し、複数の[[Wikipedia:database|データベース]]と34もの言語をサポートしています。
+
Redmine は [[Ruby on Rails]] フレームワークを使用して書かれています。クロスプラットフォームで動作し、複数の[[Wikipedia:database|データベース]]と 34 もの言語をサポートしています。
   
  +
== インストール ==
==要件==
 
   
  +
この文書は、Redmine の推奨されるインストールプロセスを案内します。
このドキュメントでは Redmine のインストール手順をガイドするにあたって、Redmine を使うのに必要なソフトウェアも一緒に説明します。しかしながら、Redmine と依存パッケージを別々にインストールすることも可能です。その場合は下のセクションを参照してください。
 
   
  +
何らかの理由で手動で Redmine をセットアップしたい場合は、公式の[https://redmine.org/projects/redmine/wiki/RedmineInstall インストールガイド]に従うことを推奨します。
ここではインストール手順を全て説明しますが、必ずしもこの方法しかないというわけではありません。Redmine が必要とするソフトウェアには様々な選択肢が考えられます。例えば、データベースには mariaDB, mySQL, postgreSQL などがあります。
 
   
  +
テスト目的で単独で Redmine を実行することは可能ですが、本番環境で使用する場合は、SQL データベースとウェブサーバーが必要です。
{{Note|This guide is a default suggestion, feel free to substitute any of the prerequisites mentioned on this page.}}
 
  +
データベースには [[MariaDB]] や [[PostgreSQL]] の使用が推奨されます。
  +
サポートされているウェブサーバーは以下の通りです:
   
  +
* [https://www.phusionpassenger.com/ Phusion Passenger] 経由で [[Apache HTTP Server|Apache]] または [[nginx]] を使用
===Ruby===
 
  +
* [[Ruby on Rails#Puma (Nginx をリバースプロキシサーバーとして)]]
 
  +
* [[Ruby on Rails#Unicorn]]
{| border="1" class="wikitable" style="text-align:center;"
 
! Redmine バージョン
 
! サポートされている Ruby バージョン
 
! 使用する Rails バージョン
 
|-
 
! 3.0.2
 
| '''ruby''' 1.9.3<sup>3</sup>, 2.0.0<sup>2</sup>, 2.1, 2.2<sup>1</sup>
 
| '''Rails''' 4.2<sup>0</sup>
 
|}
 
 
Ruby をインストールする方法は2つ存在します: [[Ruby]] のページに書かれているように {{Pkg|ruby}} パッケージをインストールする方法と [[RVM]] のページに書かれているように RVM をインストールする方法です (後者が推奨されています)。
 
 
{{Note |
 
* <sup>0</sup> Rails 4.2.1 has non ASCII URL issue on MinGW Ruby ([http://rubyinstaller.org/ Windows-based installer]) thin and puma ([http://www.redmine.org/issues/19321 #19321], [http://www.redmine.org/issues/19374 #19374])
 
* <sup>1</sup> MinGW Ruby 2.2 には nokogiri の問題があります ([http://www.redmine.org/issues/19419 #19419])。
 
* <sup>2</sup> As of 2013-03-19, SQL Server support is reported broken with '''ruby 2.0.0 under Windows''' because of a [https://github.com/rails-sqlserver/tiny_tds/issues/110 database adapter gem incompatibility]
 
* <sup>3</sup> MRI 1.9.3p327 contains a [http://bugs.ruby-lang.org/issues/7374 bug] breaking plugin loading under Windows which 1.9.3p194 or 1.9.3p392 haven't.}}
 
{{Warning|If you use RVM, pay attention to the single and multiple user differences! If you are not creating a hosting service, the multiple user (available for all users on the machine) should be the choice for simpler debuging.}}
 
 
===データベース===
 
 
Redmine は [http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Database 多数のデータベース] に対応しています。
 
 
====MariaDB 5.0 以上 (推奨)====
 
MariaDB は MySQL のフォークでありバイナリ互換性が保たれています。また、[https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/ Arch Linux における MySQL のデフォルト実装] でもあります。
 
 
{{Pkg|mariadb}} のインストールについては [[MySQL]] を参照してください。
 
 
====MySQL 5.0 以上====
 
[https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/ Oracle MySQL] は [[AUR]] に移動しました。
 
 
[[AUR]] の {{AUR|mysql}} パッケージをインストールしてください。
 
 
====PostgreSQL 8.2 以上====
 
{{Pkg|postgresql}} のインストールについては [[PostgreSQL]] を参照してください。
 
 
データベースのデータ形式は ISO に設定してください (PostgreSQL のデフォルト設定)。次のコマンドで設定できます:
 
 
{{bc|1=ALTER DATABASE "redmine_db" SET datestyle="ISO,MDY";}}
 
 
{{Note|PostgreSQL 8.4.0 と 8.4.1 には Redmine に影響を与えるバグが存在します ([http://www.redmine.org/issues/4259 #4259], [http://www.redmine.org/issues/4314 #4314])。バグは PostgreSQL 8.4.2 で修正されました。}}
 
 
====Microsoft SQL Server====
 
{{Warning|Support is temporarily broken (with ruby 2.0.0 under Windows because of [https://github.com/rails-sqlserver/tiny_tds/issues/110 database adapter gem incompatibility]).}}
 
 
====SQLite 3====
 
本番環境におけるマルチユーザーはサポートされていません。そのため Redmine で使うためにインストール・設定する方法は説明しません。詳しくは [http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Supported-database-back-ends 上流のドキュメント] を参照。
 
 
===ウェブサーバー===
 
 
====Apache====
 
{{Pkg|apache}} のインストールについては [[Apache]] を参照してください。
 
 
==== Unicorn ====
 
Unicorn サーバーのインストール (ruby gem) については [[Ruby on Rails#Unicorn]] を参照してください。
 
 
====Nginx====
 
{{Pkg|nginx}} のインストールについては [[Nginx]] を参照してください。
 
 
====Apache Tomcat====
 
{{Pkg|tomcat6}} や {{Pkg|tomcat7}} のインストールについては [[Tomcat]] を参照してください。
 
 
==オプション==
 
 
===SCM (Source Code Management)===
 
 
<table border="1" class="wikitable">
 
<tr>
 
<th>SCM</th>
 
<th>サポートされているバージョン</th>
 
<th>注記</th>
 
</tr>
 
<tr>
 
<td>[http://git-scm.com Git]</td>
 
<td>>=1.5.4.2</td>
 
<td></td>
 
</tr>
 
<tr>
 
<td>[http://subversion.apache.org Subversion]</td>
 
<td>1.3, 1.4, 1.5, 1.6 & 1.7</td>
 
<td>1.3 以上が必要です。<br/>Subversion の Ruby バインディングはサポートされません。<br/>Subversion 1.7.0 と 1.7.1 にはバグが存在します [http://www.redmine.org/issues/9541 #9541]。</td>
 
</tr>
 
<tr>
 
<td>[http://www.selenic.com/mercurial Mercurial]</td>
 
<td>>=1.6</td>
 
<td>バージョン 1.6 未満のサポートは外されました [http://www.redmine.org/issues/9465 #9465]。</td>
 
</tr>
 
<tr>
 
<td>[http://bazaar-vcs.org Bazaar]</td>
 
<td>>= 2.0.4</td>
 
<td></td>
 
</tr>
 
<tr>
 
<td>[http://darcs.net Darcs]</td>
 
<td>>=1.0.7</td>
 
<td></td>
 
</tr>
 
<tr>
 
<td>[http://www.nongnu.org/cvs CVS]</td>
 
<td>1.12.12</td>
 
<td>1.12 が必要。<br/>CVSNT では動作しません。</td>
 
</tr>
 
</table>
 
 
詳細は [http://www.redmine.org/projects/redmine/wiki/RedmineRepositories Redmine Repositories Wiki] を参照。
 
 
===ImageMagick (推奨)===
 
ガントチャートを [[wikipedia:Portable_Network_Graphics|PNG]] ファイルにエクスポートするには [http://www.imagemagick.org ImageMagick] が必要です。
 
 
{{pkg|imagemagick}} をインストールするには:
 
# pacman -S imagemagick
 
 
===Ruby OpenID ライブラリ===
 
[http://janrain.com/openid-enabled OpenID] のサポートを有効にするには、Ruby の OpenID ライブラリのバージョン2以上が必要です。
 
   
 
==インストール==
 
==インストール==
   
 
===ビルドとインストール===
 
===ビルドとインストール===
[[AUR]] から {{AUR|redmine}} パッケージをダウンロード・ビルド・インストールしてください。
+
[[AUR]] から {{Pkg|redmine}} パッケージをダウンロード・ビルド・インストールしてください。
   
 
{{Note|ビルド方法は[[Arch User Repository#パッケージのビルド|パッケージのビルド]]に書かれています。[[AUR]] のページを読むことを強く推奨します。}}
 
{{Note|ビルド方法は[[Arch User Repository#パッケージのビルド|パッケージのビルド]]に書かれています。[[AUR]] のページを読むことを強く推奨します。}}
189行目: 78行目:
 
GO}}
 
GO}}
   
  +
{{Note|追加の環境を使用したい場合は、それぞれに個別のデータベースを作成する必要があります(例: ''開発環境''と''テスト環境'')。}}
{{Note|If you want to use additional environments, you must create separate databases for each one (for example: ''development'' and ''test'').}}
 
   
 
====データベースのアクセス設定====
 
====データベースのアクセス設定====
210行目: 99行目:
 
password: my_password}}
 
password: my_password}}
   
{{Note|For ruby1.9 the "adapter" value must be set to {{ic|mysql2}}, and for ruby1.8 or jruby, it must be set to {{ic|mysql}}.}}
+
{{Note|ruby1.9 では "adapter" の値は {{ic|mysql2}} に設定する必要があり、ruby1.8 jruby の場合は {{ic|mysql}} に設定する必要があります。}}
   
 
PostgreSQL データベースの例:
 
PostgreSQL データベースの例:
261行目: 150行目:
 
====Gem のインストール====
 
====Gem のインストール====
   
  +
{{Note|必要であれば、gem を全て pacman のパッケージとしてインストールすることもできます。gem パッケージを検索して通常通りにインストールするだけです。Ruby gem を使うほうが gem の管理は簡単なので、以下では Ruby gem を使用しています。}}
{{Note|If you prefer, you can install all the gems as pacman packages. You have only to search for the gem package and install them as usual. As of using Ruby gem is much simpler to manage and maintain up to date gems, this will be preferable and used as default bellow.}}
 
   
 
Redmine は Bundler を使用して Gem の依存関係を管理するため、最初に Bundler をインストールしてください:
 
Redmine は Bundler を使用して Gem の依存関係を管理するため、最初に Bundler をインストールしてください:
273行目: 162行目:
 
# bundle install --without development test
 
# bundle install --without development test
   
  +
{{Note|上記の構文を使って、環境をインクルード/エクスクルードすることができます。}}
{{Note|You can include/exclude environments using the above syntax.}}
 
   
 
{{Pkg|imagemagick}} はインストールすることが[[#ImageMagick (推奨)|推奨]]されていますが、使用しない場合、以下のコマンドで {{ic|rmagick}} gem のインストールをスキップしてください:
 
{{Pkg|imagemagick}} はインストールすることが[[#ImageMagick (推奨)|推奨]]されていますが、使用しない場合、以下のコマンドで {{ic|rmagick}} gem のインストールをスキップしてください:
279行目: 168行目:
 
# bundle install --without rmagick
 
# bundle install --without rmagick
   
  +
{{Note|データベース設定ファイルで指定したアダプタが必要とする gem だけが実際にインストールされます (例えば {{ic|config/database.yml}} が ''mysql2'' アダプタを使用している場合、mysql2 gem だけがインストールされます)。このファイルでアダプタを変更したり追加したりした場合は、忘れずに {{ic|bundle install}} を再実行してください。}}
{{Note|Only the gems that are needed by the adapters you have specified in your database configuration file are actually installed (eg. if your {{ic|config/database.yml}} uses the ''mysql2'' adapter, then only the mysql2 gem will be installed). Do not forget to re-run {{ic|bundle install}} when you change or add adapters in this file.}}
 
   
  +
===セッションストア秘密鍵の生成===
===Session Store Secret Generation===
 
  +
セッションデータを保存する cookie を暗号化して改竄を防止するランダムな鍵を生成する必要があります:
Now you must generate a random key that will be used by Rails to encode cookies that stores session data thus preventing their tampering:
 
   
 
# bundle exec rake generate_secret_token
 
# bundle exec rake generate_secret_token
   
{{Note|For Redmine prior to 2.x this step is done by executing {{ic|# bundle exec rake generate_session_store}}.}}
+
{{Note|Redmine 2.x 以前では {{ic|# bundle exec rake generate_session_store}} を実行することで生成できます。}}
   
  +
{{Warning|新しい秘密鍵を生成すると既存のセッションは全て無効になります。}}
{{Warning|Generating a new secret token invalidates all existing sessions after restart.}}
 
   
  +
===データベース構造の作成===
===Database Structure Creation===
 
  +
データベースを作成して Redmine のアクセス権限を設定したら、データベース構造を作成してください。アプリケーションのルートディレクトリに以下のコマンドを実行することで作成できます:
With the database created and the access configured for Redmine, now it is time to create the database structure. This is done by running the following command under the application root directory:
 
   
 
# cd /usr/share/webapps/redmine
 
# cd /usr/share/webapps/redmine
 
# RAILS_ENV=production bundle exec rake db:migrate
 
# RAILS_ENV=production bundle exec rake db:migrate
   
  +
上記のコマンドはマイグレーションを全て実行してテーブルを作成し、パーミッションやアプリケーションの管理者アカウント (admin) を作成します。
These command will create tables by running all migrations one by one then create the set of the permissions and the application administrator account, named admin.
 
   
  +
===デフォルトデータでデータベースを作成===
===Database Population with Default Data===
 
  +
基本的なタスクやタスクの状態、グループなど、デフォルトの設定データをデータベースに挿入するには:
Now you may want to insert the default configuration data in database, like basic types of task, task states, groups, etc. To do so execute the following:
 
   
 
# RAILS_ENV=production bundle exec rake redmine:load_default_data
 
# RAILS_ENV=production bundle exec rake redmine:load_default_data
   
  +
Redmine はロードするデータセットの言語を聞いてきます。コマンドを実行する前に REDMINE_LANG 環境変数を定義することで自動的に値を決めさせることもできます:
Redmine will prompt for the data set language that should be loaded; you can also define the REDMINE_LANG environment variable before running the command to a value which will be automatically and silently picked up by the task:
 
   
 
# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake redmine:load_default_data
 
# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake redmine:load_default_data
   
  +
{{Note|このステップは必須ではありませんが、Redmine を使い始めるのに多くの手間が省けることは確かです。また、初めての方にはとても勉強になります。}}
{{Note|This step is not mandatory, but it certainly will save you a lot of work to start using Redmine. And for a first time it can be very instructive.}}
 
   
 
===ファイルシステムのパーミッション===
 
===ファイルシステムのパーミッション===
  +
アプリケーションを実行するユーザーアカウントは以下のサブディレクトリに書き込む権限がなければなりません:
The user account running the application '''must''' have write permission on the following subdirectories:
 
   
'''files''': storage of attachments.
+
'''files''': 添付ファイルのストレージ。
'''log''': application log file production.log.
+
'''log''': アプリケーションログファイル production.log
'''tmp''' and '''tmp/pdf''': used to generate PDF documents among other things (create these ones if not present).
+
'''tmp''' '''tmp/pdf''': PDF ドキュメントの生成などに使われます。
   
  +
デフォルトの Apache ユーザーである {{ic|http}} アカウントを使ってアプリケーションを実行する場合:
Assuming you run the application with a the default Apache user {{ic|http}} account:
 
   
 
# mkdir tmp tmp/pdf public/plugin_assets
 
# mkdir tmp tmp/pdf public/plugin_assets
323行目: 212行目:
   
 
===インストールのテスト===
 
===インストールのテスト===
  +
WEBrick ウェブサーバーを使って新しくインストールした環境をテストするには Redmine のフォルダで以下のコマンドを実行:
To test your new installation using WEBrick web server run the following in the Redmine folder:
 
   
 
# ruby bin/rails server webrick -e production
 
# ruby bin/rails server webrick -e production
   
  +
WEBrick が起動したらブラウザで '''http://localhost:3000/''' を開いてください。アプリケーションのウェルカムページが表示されます。デフォルトの管理者アカウントを使ってログインしてください: '''''admin'''''/'''''admin'''''。管理者メニューから設定を選択することでアプリケーションの設定が行えます。
Once WEBrick has started, point your browser to '''http://localhost:3000/'''. You should now see the application welcome page. Use default administrator account to log in: '''''admin'''''/'''''admin'''''. You can go to Administration menu and choose Settings to modify most of the application settings.
 
   
{{Warning|Webrick is not suitable for production use, please only use webrick for testing that the installation up to this point is functional. Use one of the many other guides in this wiki to setup redmine to use either Passenger (aka mod_rails), FCGI or a Rack server (Unicorn, Thin, Puma or hellip) to serve up your redmine.}}
+
{{Warning|Webrick は本番環境での利用には向いていません。あくまで動作するかどうかテストするときだけ webrick を使ってください。redmine を本番環境で使用する際は Passenger (別名 mod_rails), FCGI, Rack サーバー (Unicorn, Thin, Puma, hellip) のどれかをセットアップしてください。}}
   
 
===プロダクションサーバーの設定===
 
===プロダクションサーバーの設定===
For Apache and Nginx, it is recommended to use Phusion Passenger. [http://www.modrails.com/ Passenger], also known as {{ic|mod_rails}}, is a module available for [[Nginx]] and [[Apache]].
 
   
  +
==== Puma / Unicorn ====
Start by installing the 'passenger' gem:
 
  +
  +
Puma と Unicorn は Mongrel ベースのウェブサーバーです。速度の向上とメモリ使用量の削減のため、[https://puma.io/ Puma] が推奨されます。どちらも設定は非常にシンプルですが、本番使用ではリバースプロキシ(Apache、Nginx、lighttpd など)と組み合わせて使用すべきです。
  +
  +
# gem install puma
  +
# sudo -u http -g http /opt/ruby2.6/bin/puma
  +
  +
本番環境では、puma を systemd サービスとして起動できます:
  +
  +
{{hc|/etc/systemd/system/redmine.service|2=
  +
[Unit]
  +
Description=Redmine
  +
After=network.target
  +
  +
[Service]
  +
User=http
  +
Group=http
  +
RestartSec=1
  +
Restart=always
  +
StartLimitInterval=10
  +
StartLimitBurst=10
  +
WorkingDirectory=/usr/share/webapps/redmine/
  +
ExecStart=/opt/ruby2.6/bin/puma -e production -p 9292
  +
  +
[Install]
  +
WantedBy=multi-user.target}}
  +
  +
[[daemon-reload]] の完了後、{{ic|redmine.service}} を[[開始/有効化]]してください。
  +
  +
==== Phusion Passenger ====
  +
  +
Apache や Nginx の場合、Phusion Passenger を使用することが推奨されます。[http://www.modrails.com/ Passenger] (別名 {{ic|mod_rails}}) は [[Nginx]] や [[Apache]] のモジュールとして使うことが可能です。
  +
  +
まず 'passenger' gem をインストール:
 
# gem install passenger
 
# gem install passenger
   
  +
passenger gem のインストールディレクトリに移動してください。場所が分からない場合、以下のコマンドを実行してください:
Now you have to look at your passenger gem installation directory to continue. If you do not known where it is, type:
 
 
# gem env
 
# gem env
   
  +
gem がインストールされる場所は {{ic|GEM PATHS}} です。このページのガイドに従って [[RVM]] をインストールしている場合、使用しているパスを確認してください。
And look at the {{ic|GEM PATHS}} to find where the gems are installed. If you followed this guide and installed [[RVM]], you can have more than one path, look at the one you are using.
 
   
For this guide so far, the gem path is {{ic|/usr/local/rvm/gems/ruby-2.0.0-p247@global}}.
+
ここでは gem のパスは {{ic|/usr/local/rvm/gems/ruby-2.0.0-p247@global}} とします。
 
# cd /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/passenger-4.0.23
 
# cd /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/passenger-4.0.23
   
If you are aiming to use [[Apache]], run:
+
[[Apache]] を使用する場合:
 
# passenger-install-apache2-module
 
# passenger-install-apache2-module
   
In case a rails application is deployed with a sub-URI, like http://example.com/yourapplication, some additional configuration is required, see [http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri the modrails documentation]
+
http://example.com/yourapplication のような URI rails アプリケーションをデプロイするときは追加の設定が必要です。[http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri modrails のドキュメント] を見てください。
   
For [[Nginx]]:
+
[[Nginx]] の場合:
 
# passenger-install-nginx-module
 
# passenger-install-nginx-module
   
  +
最後に、インストーラーはインストールに関する情報 (追加ライブラリのインストールなど) を提供します。passenger インストーラーの指示に従ってサーバーをセットアップしてください。
And finally, the installer will provide you with further information regarding the installation (such as installing additional libraries). So, to setup your server, simply follow the output from the passenger installer.
 
   
 
==アップデート==
 
==アップデート==
380行目: 301行目:
 
# bundle update
 
# bundle update
   
  +
gem 環境をクリーンするために、全ての gem を削除してから再インストールすると良いでしょう。以下のコマンドで削除できます:
For a clean gems environment, you may want to remove all the gems and reinstall them. To go through this, do:
 
 
# for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done
 
# for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done
   
 
{{Warning|The command above will delete ALL the gems in your system or user, depending of what type of Ruby installation you did in the prerequisites step. You must take care or you can stop working another applications that rely on Ruby gems.}}
 
{{Warning|The command above will delete ALL the gems in your system or user, depending of what type of Ruby installation you did in the prerequisites step. You must take care or you can stop working another applications that rely on Ruby gems.}}
   
  +
全ての gem を削除したら、以下のコマンドで再インストールしてください:
If you did the last step and removed all the gems, now you will need to reinstall them all:
 
 
# gem install bundler
 
# gem install bundler
 
# bundle install --without development test
 
# bundle install --without development test
391行目: 312行目:
 
{{Note|If you removed ALL the gems as above, and used a server that uses a gem, remember to reinstall the server gem: passenger (for Apache and Nginx), Mongrel or Unicorn. To do this, just follow the steps in the installation tutorial above.}}
 
{{Note|If you removed ALL the gems as above, and used a server that uses a gem, remember to reinstall the server gem: passenger (for Apache and Nginx), Mongrel or Unicorn. To do this, just follow the steps in the installation tutorial above.}}
   
  +
保存したファイルをコピー:
Copy the saved files:
 
 
# tar xzvf ~/redmine_files.tar.gz -C /usr/share/webapps/redmine/
 
# tar xzvf ~/redmine_files.tar.gz -C /usr/share/webapps/redmine/
   
  +
インストールしたプラグインをコピー:
Copy the installed plugins
 
 
# tar xzvf ~/redmine_plugins.tar.gz -C /usr/share/webapps/redmine/
 
# tar xzvf ~/redmine_plugins.tar.gz -C /usr/share/webapps/redmine/
   
  +
シークレットトークンを再生成:
Regenerate the secret token:
 
 
# cd /usr/share/webapps/redmine
 
# cd /usr/share/webapps/redmine
 
# bundle exec rake generate_secret_token
 
# bundle exec rake generate_secret_token
   
  +
{{ic|public/themes}} ディレクトリにインストールしたテーマをチェックしてください。そのままコピーすることもできますが最新のバージョンがないか確認したほうが良いでしょう。
Check for any themes that you may have installed in the {{ic|public/themes}} directory. You can copy them over but checking for updated version is ideal.
 
   
{{Warning|Do NOT overwrite config/settings.yml with the old one.}}
+
{{Warning|{{ic|config/settings.yml}} を古いファイルで上書きしてはいけません。}}
   
  +
データベースをアップデートしてください。データベースの中身が変わる可能性があります。新しい redmine ディレクトリからデータベースを以降してください:
Update the database. This step is the one that could change the contents of your database. Go to your new redmine directory, then migrate your database:
 
 
# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake db:migrate
 
# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake db:migrate
   
  +
プラグインをインストールしている場合、プラグインのデータベースも移行する必要があります:
If you have installed any plugins, you should also run their database migrations:
 
 
# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake redmine:plugins:migrate
 
# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake redmine:plugins:migrate
   
  +
キャッシュと既存のセッションを消去してください:
Now, it is time to clean the cache and the existing sessions:
 
 
# RAILS_ENV=production bundle exec rake tmp:cache:clear tmp:sessions:clear
 
# RAILS_ENV=production bundle exec rake tmp:cache:clear tmp:sessions:clear
   
Restart the application server (e.g. puma, thin, passenger, etc). And finally go to "Admin -> Roles & permissions" to check/set permissions for the new features, if any.
+
アプリケーションサーバー (例: puma, thin, passenger) を再起動してください。最後に "Admin -> Roles & permissions" から新しい機能があればパーミッションを確認・設定してください。
   
 
==トラブルシューティング==
 
==トラブルシューティング==
  +
=== RMagick が古いバージョンで設定されているというエラーが発生する ===
===RMagick gem without support for High Dynamic Range in ImageMagick===
 
As of ImageMagick 6.8.6.8-1, it is built with HDRI (High Dynamic Range Image) support, and this breaks the RMagick gem as seen in {{Bug|36518}}.
 
   
  +
ImageMagick をアップグレードしたときに {{ic|This installation of RMagick was configured with ImageMagick 6.8.7 but ImageMagick 6.8.8-1 is in use.}} というエラーが発生する場合、再インストールが必要です (もしくは上記のように再ビルドしてください)。
The github [https://github.com/rmagick/rmagick rmagick] is already patched, but the mantainer did not packed it for rubygems yet.
 
   
  +
{{Note|RMagick の gem をインストールしたときにネイティブ拡張がコンパイルされますが、ImageMagick をアップグレードすると再ビルドが必要になるため再インストールが必要になります。}}
To install this patched version download the git repository:
 
# git clone https://github.com/rmagick/rmagick.git
 
 
Then, you need to build the gem:
 
# cd rmagick
 
# gem build rmagick.gemspec
 
 
And finally install it:
 
# gem install rmagick-2.13.2.gem
 
 
{{Note|It will show some complains like {{ic|unable to convert "\xE0" from ASCII-8BIT to UTF-8 for ext/RMagick/RMagick2.so, skipping}}, but you can safelly ignore it.}}
 
 
===Runtime error complaining that RMagick was configured with older version===
 
 
If you get the following runtime error after upgrading ImageMagick {{ic|This installation of RMagick was configured with ImageMagick 6.8.7 but ImageMagick 6.8.8-1 is in use.}} then you only need to reinstall (or rebuild as shown above if is the case).
 
 
{{Note|This is due to that when you install the RMagick gem it compiles some native extensions and they may need to be rebuilt after some ImageMagick upgrades.}}
 
 
=== OpenSSL の "SSLv3_client" エラー ===
 
 
最新リリースの OpenSSL (バージョン 1.0.2.g-3) では ruby は動作せず複数の ruby バージョンをビルドできません。以下の方法で解決します:
 
 
1. ruby-head (RVM を使用する場合) あるいは 2.3.0 以上 (Arch のパッケージを使用する場合) を使用する。
 
 
2. [https://github.com/rvm/rvm/issues/3529#issuecomment-157205030 Issue 3529] や [https://github.com/rvm/rvm/issues/3548 Issue 3548] に書かているパッチを使用する:
 
 
# curl https://github.com/ruby/ruby/commit/801e1fe46d83c856844ba18ae4751478c59af0d1.diff > openssl.patch
 
# rvm install --patch ./openssl.patch 2.0.0 /*or another ruby version*/
 
   
 
===gem のインストール時にエラー: Cannot load such file -- mysql2/mysql2===
 
===gem のインストール時にエラー: Cannot load such file -- mysql2/mysql2===
   
  +
{{ic|cannot load such file -- mysql2/mysql2}} というエラーが表示される場合、データベース gem のインストールに問題が起こっています。おそらく[[#データベースのアクセス設定|データベースのアクセス設定]]で行った設定が誤っています。{{ic|database.yml}} ファイルを確認してください。
If you see an error like {{ic| cannot load such file -- mysql2/mysql2}}, you are having a problem with the installation of the database gem. Probably a misconfiguration in the [[#Database Access Configuration|Database Access Configuration]] step.
 
In this case you should verify the {{ic|database.yml}} file.
 
   
  +
以下のコマンドを使って手動でデータベース gem をインストールすることもできます:
If no success, you can manually install the database gem by:
 
   
 
# gem install mysql2
 
# gem install mysql2
   
  +
Bobdog によって提案されているように、データベースの gem の行をコメントアウトして以下のように新しい行を追加することができます:
In last case, as suggested by Bobdog, you can try to comment the line of the database gem and add a new one as bellow:
 
   
 
{{hc|<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.rb|
 
{{hc|<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.rb|
466行目: 358行目:
 
require '<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.so'}}
 
require '<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.so'}}
   
  +
=== SVN ソースのチェックアウト ===
=== Apache 2.4 Updating ===
 
  +
Redmine のソースを取得します ([http://www.redmine.org/projects/redmine/wiki/Download ダウンロード手順])。以下は subversion から {{ic|/srv/http/redmine/}} に直接 Redmine をインストールする方法です:
 
When updating to Apache 2.4 will be necessary to remove and install all your gems to make sure all of them that need to build native extensions will be rebuilt against the new Apache server.
 
 
So, for a clean gems environment, remove all the gems:
 
 
# for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done
 
 
To reinstall the gems:
 
 
# cd /usr/share/webapps/redmine
 
# gem install bundler
 
# bundle install --without development test
 
 
Remember to reinstall the RMagick gem as describe above in [[#RMagick gem without support for High Dynamic Range in ImageMagick|RMagick gem without support for High Dynamic Range in ImageMagick]].
 
 
And if you are using Passenger to serve your apps through Apache you will need to reinstall it as described above in [[#Configure the production server|Configure the production server]].
 
 
=== Checkout SVN Source ===
 
Get the Redmine source ([http://www.redmine.org/projects/redmine/wiki/Download Download instructions]). Here is method of installing Redmine directly from subversion in /srv/http/redmine/
 
 
# useradd -d /srv/http/redmine -s /bin/false redmine
 
# useradd -d /srv/http/redmine -s /bin/false redmine
 
# mkdir -p /srv/http/redmine
 
# mkdir -p /srv/http/redmine
491行目: 365行目:
 
# chown -R redmine: /srv/http/redmine
 
# chown -R redmine: /srv/http/redmine
   
=== Automating The Update Process ===
+
=== アップデートの自動化 ===
Example of an after-update script:
+
after-update スクリプトの例:
   
 
#!/usr/bin/bash
 
#!/usr/bin/bash
499行目: 373行目:
 
bundle update && bundle exec rake generate_secret_token db:migrate redmine:plugins:migrate tmp:cache:clear tmp:sessions:clear
 
bundle update && bundle exec rake generate_secret_token db:migrate redmine:plugins:migrate tmp:cache:clear tmp:sessions:clear
   
  +
{{Note|上記のスクリプトはアプリケーションサーバーとして Thin を使います。必要に応じて変更してください。}}
{{Note| Note that this script uses Thin as application server, so you must change it to your needs.}}
 
   
 
=== Systemd ユニットの作成===
 
=== Systemd ユニットの作成===
  +
システムが起動したときに自動的にアプリケーションサーバーを立ち上げたい場合、systemd のユニットファイルを作成してください。
If you want to automatic run you application server when system starts, you need to create a systemd unit file.
 
   
  +
{{Note|{{Pkg|apache}} や {{Pkg|nginx}} と Passenger gem を使用する場合は不要です。サーバーのユニットファイルを有効化するだけで使うことができます。}}
{{Note| This is not needed if you use {{Pkg|apache}} or {{Pkg|nginx}} with Passenger gem. Those servers already have their own unit file, so you have only to enable it.}}
 
   
 
{{hc|/etc/systemd/system/redmine.service|<nowiki>
 
{{hc|/etc/systemd/system/redmine.service|<nowiki>
526行目: 400行目:
   
 
</nowiki>}}
 
</nowiki>}}
 
=== Complaints about psych===
 
 
Like that:
 
 
/usr/lib/ruby/2.1.0/psych/parser.rb:33:in `<class:Parser>': superclass mismatch for class Mark (TypeError)
 
from /usr/lib/ruby/2.1.0/psych/parser.rb:32:in `<module:Psych>'
 
from /usr/lib/ruby/2.1.0/psych/parser.rb:1:in `<top (required)>'
 
from /usr/lib/ruby/2.1.0/psych.rb:7:in `require'
 
 
[http://www.redmine.org/boards/2/topics/36728 according to that] that is a bundler issue, and you have to add
 
gem 'psych'
 
to your Gemfile.local
 
   
 
== 参照 ==
 
== 参照 ==

2024年4月12日 (金) 10:10時点における版

関連記事

Redmineフリーかつオープンソースの、ウェブベースのプロジェクト管理課題追跡ツールです。複数のプロジェクト・サブプロジェクトを扱うことができます。機能 としてプロジェクト wiki やフォーラム、時間管理、柔軟なロールベースのアクセス制御があります。カレンダーガントチャートも搭載しており、プロジェクトのデッドラインを視覚的に把握できます。Redmine は様々なバージョン管理システムと統合できるように、リポジトリブラウザや差分ビューアを内蔵しています。

Redmine は Ruby on Rails フレームワークを使用して書かれています。クロスプラットフォームで動作し、複数のデータベースと 34 もの言語をサポートしています。

インストール

この文書は、Redmine の推奨されるインストールプロセスを案内します。

何らかの理由で手動で Redmine をセットアップしたい場合は、公式のインストールガイドに従うことを推奨します。

テスト目的で単独で Redmine を実行することは可能ですが、本番環境で使用する場合は、SQL データベースとウェブサーバーが必要です。 データベースには MariaDBPostgreSQL の使用が推奨されます。 サポートされているウェブサーバーは以下の通りです:

インストール

ビルドとインストール

AUR から redmine パッケージをダウンロード・ビルド・インストールしてください。

ノート: ビルド方法はパッケージのビルドに書かれています。AUR のページを読むことを強く推奨します。

データベースの設定

次に、Redmine がデータを保存するのに使用するデータベースを作成します。以下、データベースとそのユーザーの名前を redmine とします。適宜置き換えてください。

ノート: MariaDBMySQL はバイナリ互換性があるため設定も同じです。

データベースの作成

データベースとユーザーを作成して権限を設定 (MariaDB と MySQL >= 5.0.2):

# mysql -u root -p
CREATE DATABASE redmine CHARACTER SET UTF8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

5.0.2 以前のバージョンの MariaDB と MySQL の場合:

# mysql -u root -p
CREATE DATABASE redmine CHARACTER SET UTF8;
GRANT ALL PRIVILEGES ON redmine.* TO'redmine'@'localhost' IDENTIFIED BY 'my_password';

PostgreSQL の場合:

CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;

SQLServer の場合:

SQL Server Management Studio の中でデータベースやユーザーを作成することもできますが、SQLCMD でコマンドラインを使うこともできます:

USE [master]
GO
-- Very basic DB creation
CREATE DATABASE [REDMINE]
GO
-- Creation of a login with SQL Server login/password authentication and no password expiration policy
CREATE LOGIN [REDMINE] WITH PASSWORD=N'redminepassword', DEFAULT_DATABASE=[REDMINE], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
-- User creation using previously created login authentication
USE [REDMINE]
GO
CREATE USER [REDMINE] FOR LOGIN [REDMINE]
GO
-- User permissions set via roles
EXEC sp_addrolemember N'db_datareader', N'REDMINE'
GO
EXEC sp_addrolemember N'db_datawriter', N'REDMINE'
GO
ノート: 追加の環境を使用したい場合は、それぞれに個別のデータベースを作成する必要があります(例: 開発環境テスト環境)。

データベースのアクセス設定

作成したデータベースにアクセスするように Redmine を設定する必要があります。/usr/share/webapps/redmine/config/database.yml.exampledatabase.yml にコピーしてください:

# cd /usr/share/webapps/redmine/config
# cp database.yml.example database.yml

そしてファイルを編集して "production" 環境のデータベース設定を変更してください ("development" と "test" 環境の設定を行うこともできます)。

MariaDB や MySQL データベースの例:

nano database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  port: 3307   #If your server is not running on the standard port (3306), set it here, otherwise this line is unnecessary.
  username: redmine
  password: my_password
ノート: ruby1.9 では "adapter" の値は mysql2 に設定する必要があり、ruby1.8 や jruby の場合は mysql に設定する必要があります。

PostgreSQL データベースの例:

nano database.yml
production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: my_password
  encoding: utf8
  schema_search_path: <database_schema> (default - public)

SQL Server データベースの例:

nano database.yml
production:
  adapter: sqlserver
  database: redmine
  host: localhost #Set not default host (localhost) here, otherwise this line is unnecessary.
  port: 1433 #Set not standard port (1433) here, otherwise this line is unnecessary.
  username: redmine
  password: my_password

Ruby gem

Redmine は複数の RubyGems のインストールを必要としますが Gem のインストール方法は複数あります。

  • prototype-rails
  • unicorn (アプリケーションサーバー)
  • mysql2 (MySQL の高性能な Ruby バインディング)
  • coderay
  • erubis
  • fastercsv
  • rdoc
  • net-ldap
  • rack-openid

MySQL 以外のデータベースサーバーを使用する場合や、Unicorn 以外のアプリケーションサーバーを使う場合は、mysql2unicorn を適当な Gem に置き換えてください。

Gem の追加 (任意)

Redmine コアによって必要とされない gem をロードする必要がある場合 (例: Puma, fcgi)、redmine のルートディレクトリに Gemfile.local という名前のファイルを作成してください。bundle install の実行時に自動的にロードされます:

# nano Gemfile.local
gem 'puma'

前にインストールした gem のチェック

Redmine の開発者は Redmine に Bundler を同梱しており、pacman のパッケージ管理と同じように gem を管理できます。以下のコマンドを実行して Redmine の依存関係が完全に満たされているか確認してください:

# bundle install --without development test

Redmine が必要とする gem のリストが出力されます。

Gem のインストール

ノート: 必要であれば、gem を全て pacman のパッケージとしてインストールすることもできます。gem パッケージを検索して通常通りにインストールするだけです。Ruby gem を使うほうが gem の管理は簡単なので、以下では Ruby gem を使用しています。

Redmine は Bundler を使用して Gem の依存関係を管理するため、最初に Bundler をインストールしてください:

# gem install bundler

以下のコマンドを使うことで Redmine が必要とする Gem を全てインストールできます:

# cd /usr/share/webapps/redmine
# bundle install

ruby の developmenttest 環境を使わずにインストールする場合、代わりに以下のコマンドを使ってください:

# bundle install --without development test
ノート: 上記の構文を使って、環境をインクルード/エクスクルードすることができます。

imagemagick はインストールすることが推奨されていますが、使用しない場合、以下のコマンドで rmagick gem のインストールをスキップしてください:

# bundle install --without rmagick
ノート: データベース設定ファイルで指定したアダプタが必要とする gem だけが実際にインストールされます (例えば config/database.ymlmysql2 アダプタを使用している場合、mysql2 gem だけがインストールされます)。このファイルでアダプタを変更したり追加したりした場合は、忘れずに bundle install を再実行してください。

セッションストア秘密鍵の生成

セッションデータを保存する cookie を暗号化して改竄を防止するランダムな鍵を生成する必要があります:

# bundle exec rake generate_secret_token
ノート: Redmine 2.x 以前では # bundle exec rake generate_session_store を実行することで生成できます。
警告: 新しい秘密鍵を生成すると既存のセッションは全て無効になります。

データベース構造の作成

データベースを作成して Redmine のアクセス権限を設定したら、データベース構造を作成してください。アプリケーションのルートディレクトリに以下のコマンドを実行することで作成できます:

# cd /usr/share/webapps/redmine
# RAILS_ENV=production bundle exec rake db:migrate

上記のコマンドはマイグレーションを全て実行してテーブルを作成し、パーミッションやアプリケーションの管理者アカウント (admin) を作成します。

デフォルトデータでデータベースを作成

基本的なタスクやタスクの状態、グループなど、デフォルトの設定データをデータベースに挿入するには:

# RAILS_ENV=production bundle exec rake redmine:load_default_data

Redmine はロードするデータセットの言語を聞いてきます。コマンドを実行する前に REDMINE_LANG 環境変数を定義することで自動的に値を決めさせることもできます:

# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake redmine:load_default_data
ノート: このステップは必須ではありませんが、Redmine を使い始めるのに多くの手間が省けることは確かです。また、初めての方にはとても勉強になります。

ファイルシステムのパーミッション

アプリケーションを実行するユーザーアカウントは以下のサブディレクトリに書き込む権限がなければなりません:

files: 添付ファイルのストレージ。
log: アプリケーションログファイル production.log。
tmptmp/pdf: PDF ドキュメントの生成などに使われます。

デフォルトの Apache ユーザーである http アカウントを使ってアプリケーションを実行する場合:

# mkdir tmp tmp/pdf public/plugin_assets
# chown -R http:http files log tmp public/plugin_assets
# chmod -R 755 files log tmp tmp/pdf public/plugin_assets

インストールのテスト

WEBrick ウェブサーバーを使って新しくインストールした環境をテストするには Redmine のフォルダで以下のコマンドを実行:

# ruby bin/rails server webrick -e production

WEBrick が起動したらブラウザで http://localhost:3000/ を開いてください。アプリケーションのウェルカムページが表示されます。デフォルトの管理者アカウントを使ってログインしてください: admin/admin。管理者メニューから設定を選択することでアプリケーションの設定が行えます。

警告: Webrick は本番環境での利用には向いていません。あくまで動作するかどうかテストするときだけ webrick を使ってください。redmine を本番環境で使用する際は Passenger (別名 mod_rails), FCGI, Rack サーバー (Unicorn, Thin, Puma, hellip) のどれかをセットアップしてください。

プロダクションサーバーの設定

Puma / Unicorn

Puma と Unicorn は Mongrel ベースのウェブサーバーです。速度の向上とメモリ使用量の削減のため、Puma が推奨されます。どちらも設定は非常にシンプルですが、本番使用ではリバースプロキシ(Apache、Nginx、lighttpd など)と組み合わせて使用すべきです。

# gem install puma
# sudo -u http -g http /opt/ruby2.6/bin/puma

本番環境では、puma を systemd サービスとして起動できます:

/etc/systemd/system/redmine.service
[Unit]
Description=Redmine
After=network.target

[Service]
User=http
Group=http
RestartSec=1
Restart=always
StartLimitInterval=10
StartLimitBurst=10
WorkingDirectory=/usr/share/webapps/redmine/
ExecStart=/opt/ruby2.6/bin/puma -e production -p 9292

[Install]
WantedBy=multi-user.target

daemon-reload の完了後、redmine.service開始/有効化してください。

Phusion Passenger

Apache や Nginx の場合、Phusion Passenger を使用することが推奨されます。Passenger (別名 mod_rails) は NginxApache のモジュールとして使うことが可能です。

まず 'passenger' gem をインストール:

# gem install passenger

passenger gem のインストールディレクトリに移動してください。場所が分からない場合、以下のコマンドを実行してください:

# gem env

gem がインストールされる場所は GEM PATHS です。このページのガイドに従って RVM をインストールしている場合、使用しているパスを確認してください。

ここでは gem のパスは /usr/local/rvm/gems/ruby-2.0.0-p247@global とします。

# cd /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/passenger-4.0.23

Apache を使用する場合:

# passenger-install-apache2-module

http://example.com/yourapplication のような URI で rails アプリケーションをデプロイするときは追加の設定が必要です。modrails のドキュメント を見てください。

Nginx の場合:

# passenger-install-nginx-module

最後に、インストーラーはインストールに関する情報 (追加ライブラリのインストールなど) を提供します。passenger インストーラーの指示に従ってサーバーをセットアップしてください。

アップデート

Redmine で使用しているファイルをバックアップ:

# tar czvf ~/redmine_files.tar.gz -C /usr/share/webapps/redmine/ files

Redmine にインストールしたプラグインをバックアップ:

# tar czvf ~/redmine_plugins.tar.gz -C /usr/share/webapps/redmine/ plugins

データベースをバックアップ:

# mysqldump -u root -p <redmine_database> | gzip > ~/redmine_db.sql.gz

普通にパッケージをアップデート (AUR):

# wget https://aur.archlinux.org/packages/re/redmine/redmine.tar.gz
# tar -zxpvf redmine.tar.gz
# cd redmine

ダウンロードしたファイルを確認して (特に PKGBUILD)、ビルド:

# makepkg -s
# pacman -U redmine-2.3.0-2-any.pkg.tar.gz
ノート: AUR のインストールやアップデートは AUR ヘルパーを使うことで簡単にできますが、サポートはされていません。

gem をアップデート:

# bundle update

gem 環境をクリーンするために、全ての gem を削除してから再インストールすると良いでしょう。以下のコマンドで削除できます:

# for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done
警告: The command above will delete ALL the gems in your system or user, depending of what type of Ruby installation you did in the prerequisites step. You must take care or you can stop working another applications that rely on Ruby gems.

全ての gem を削除したら、以下のコマンドで再インストールしてください:

# gem install bundler
# bundle install --without development test
ノート: If you removed ALL the gems as above, and used a server that uses a gem, remember to reinstall the server gem: passenger (for Apache and Nginx), Mongrel or Unicorn. To do this, just follow the steps in the installation tutorial above.

保存したファイルをコピー:

# tar xzvf ~/redmine_files.tar.gz -C /usr/share/webapps/redmine/

インストールしたプラグインをコピー:

# tar xzvf ~/redmine_plugins.tar.gz -C /usr/share/webapps/redmine/

シークレットトークンを再生成:

# cd /usr/share/webapps/redmine
# bundle exec rake generate_secret_token

public/themes ディレクトリにインストールしたテーマをチェックしてください。そのままコピーすることもできますが最新のバージョンがないか確認したほうが良いでしょう。

警告: config/settings.yml を古いファイルで上書きしてはいけません。

データベースをアップデートしてください。データベースの中身が変わる可能性があります。新しい redmine ディレクトリからデータベースを以降してください:

# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake db:migrate

プラグインをインストールしている場合、プラグインのデータベースも移行する必要があります:

# RAILS_ENV=production REDMINE_LANG=pt-BR bundle exec rake redmine:plugins:migrate

キャッシュと既存のセッションを消去してください:

# RAILS_ENV=production bundle exec rake tmp:cache:clear tmp:sessions:clear

アプリケーションサーバー (例: puma, thin, passenger) を再起動してください。最後に "Admin -> Roles & permissions" から新しい機能があればパーミッションを確認・設定してください。

トラブルシューティング

RMagick が古いバージョンで設定されているというエラーが発生する

ImageMagick をアップグレードしたときに This installation of RMagick was configured with ImageMagick 6.8.7 but ImageMagick 6.8.8-1 is in use. というエラーが発生する場合、再インストールが必要です (もしくは上記のように再ビルドしてください)。

ノート: RMagick の gem をインストールしたときにネイティブ拡張がコンパイルされますが、ImageMagick をアップグレードすると再ビルドが必要になるため再インストールが必要になります。

gem のインストール時にエラー: Cannot load such file -- mysql2/mysql2

cannot load such file -- mysql2/mysql2 というエラーが表示される場合、データベース gem のインストールに問題が起こっています。おそらくデータベースのアクセス設定で行った設定が誤っています。database.yml ファイルを確認してください。

以下のコマンドを使って手動でデータベース gem をインストールすることもできます:

# gem install mysql2

Bobdog によって提案されているように、データベースの gem の行をコメントアウトして以下のように新しい行を追加することができます:

<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.rb
# require 'mysql2/mysql2'
require '<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.so'

SVN ソースのチェックアウト

Redmine のソースを取得します (ダウンロード手順)。以下は subversion から /srv/http/redmine/ に直接 Redmine をインストールする方法です:

# useradd -d /srv/http/redmine -s /bin/false redmine
# mkdir -p /srv/http/redmine
# svn checkout http://svn.redmine.org/redmine/branches/2.1-stable /srv/http/redmine
# chown -R redmine: /srv/http/redmine

アップデートの自動化

after-update スクリプトの例:

#!/usr/bin/bash
export RAILS_ENV=production
grep -E "^gem 'thin'" Gemfile || echo "gem 'thin'" >> Gemfile
bundle update && bundle exec rake generate_secret_token db:migrate redmine:plugins:migrate tmp:cache:clear tmp:sessions:clear
ノート: 上記のスクリプトはアプリケーションサーバーとして Thin を使います。必要に応じて変更してください。

Systemd ユニットの作成

システムが起動したときに自動的にアプリケーションサーバーを立ち上げたい場合、systemd のユニットファイルを作成してください。

ノート: apachenginx と Passenger gem を使用する場合は不要です。サーバーのユニットファイルを有効化するだけで使うことができます。
/etc/systemd/system/redmine.service
[Unit]
Description=Redmine server
After=syslog.target
After=network.target

[Service]
Type=simple
User=redmine2
Group=redmine2
Environment=GEM_HOME=/home/redmine2/.gem/
ExecStart=/usr/bin/ruby /usr/share/webapps/redmine/script/rails server webrick -e production

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

[Install]
WantedBy=multi-user.target

参照