文書の表示以前のリビジョンバックリンク全て展開する/折り畳む文書の先頭へ この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。 ====== FreeBSD 9.0RにRedmine 2.3.1をインストール ====== ===== 必要なものを揃える ===== [[http://www.redmine.org/projects/redmine/wiki/RedmineInstall|Installing Redmine]]に、Redmineのインストールに必要な環境が書いてあるので準備する。 今回用意した環境。Ruby系はバージョンに煩いので要注意。 * Ruby 1.8.7 * RubyGems 1.8.25 * Rails 3.2.13 * Passenger 3.0.19 * MySQL 5.6.11 * Subversion 1.7.3 * ImageMagick 6.8.0.7 (HDRI無効でビルドしたバイナリ) ==== MySQL ==== <code bash> cd /usr/ports/databases/mysql56-server sudo make install clean </code> サーバをインストールするとクライアントも一緒に入る。 起動する。 <code bash> sudo echo 'mysql_enable="YES"' >> /etc/rc.conf sudo /usr/local/etc/rc.d/mysql-server start </code> 初めてのインストールなら、管理者パスワードを設定する。 <code bash> sudo mysql mysql> SET PASSWORD FOR root@localhost=PASSWORD('password'); mysql> exit </code> ==== ruby ==== ruby本体は既に1.8.7が入っていたので、手っ取り早くそのまま使う。 新規にインストールするなら1.9系を入れた方がいいかも? <code bash> cd /usr/ports/converters/ruby-iconv/ sudo make install clean </code> ==== RubyGems ==== <code bash> cd /usr/ports/devel/ruby-gems sudo make install clean </code> ** bundler ** <code bash> sudo gem install bundler </code> <note tip>後の工程でbundlerで必要なGemが自動インストールされるようなので、手動で他のGemを入れる必要はないかもしれない。</note> ** Rails ** <code bash> sudo gem install rails -v 3.2.13 </code> 少々時間がかかる。-Vオプションで詳細情報が見られるので、付けておくと精神的に良いかもしれない。 ** mysql ** <code bash> sudo gem install mysql </code> Ruby 1.9だとmysql2になるっぽい。 ==== Subversion ==== インストール済みなので割愛 ==== ImageMagick ==== HDRIは無効にしないといけない(デフォルトは無効)。 <code bash> cd /usr/ports/graphics/ImageMagick sudo make install clean </code> ===== Redmineのインストール ===== ソースを持ってくる。 <code bash> cd /usr/local/www sudo svn co http://svn.redmine.org/redmine/branches/2.3-stable redmine </code> データベースを作る。 <code bash> mysql -u root -p mysql> CREATE DATABASE redmine CHARACTER SET utf8; mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine_password'; mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; </code> 設定ファイルをコピー <code bash> cd /usr/local/www/redmine/config cp database.yml.example database.yml cp configuration.yml.example configuration.yml </code> データベース接続設定ファイル(database.yml)をいじる。 <code> production: adapter: mysql database: redmine host: localhost username: redmine password: "redmine_password" encoding: utf8 </code> 必要なgemをインストール <code bash> sudo bundle install --without development test </code> 秘密トークンを生成 <code bash> cd /usr/local/www/redmine sudo rake generate_secret_token </code> データベーススキーマを作成 <code bash> sudo rake db:migrate RAILS_ENV=production </code> データベースにデフォルト値を設定 <code bash> sudo rake redmine:load_default_data RAILS_ENV=production </code> パーミッション設定 <cli> # mkdir tmp tmp/pdf public/pluin_assets # chown -R www:www files log tmp public/pluin_assets # chmod -R 755 files log tmp public/pluin_assets </cli> ===== 自動起動の設定 ===== PassengerでApacheから起動するようにする。 **Passengerは3.0系列を使わないと上手く起動出来ないので、バージョン指定必須**。どこにも書いてなくて超ハマった。 <cli> # gem install passenger --version 3.0.19 </cli> Apache用のモジュールをインストール <cli> # passenger-install-apache2-module Welcome to the Phusion Passenger Apache 2 module installer, v3.0.19. This installer will guide you through the entire installation process. It shouldn't take more than 3 minutes in total. Here's what you can expect from the installation process: 1. The Apache 2 module will be installed for you. 2. You'll learn how to configure Apache. 3. You'll learn how to deploy a Ruby on Rails application. Don't worry if anything goes wrong. This installer will advise you on how to solve any problems. Press Enter to continue, or Ctrl-C to abort. The Apache 2 module was successfully installed. Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.19 PassengerRuby /usr/local/bin/ruby18 After you restart Apache, you are ready to deploy any number of Ruby on Rails applications on Apache, without any further Ruby on Rails-specific configuration! </cli> ということなので、設定ファイルを作る。 <code apache|h /usr/local/etc/apache22/Includes/passenger.conf> LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_passenger.so <IfModule passenger_module> PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.19 PassengerRuby /usr/local/bin/ruby18 </IfModule> </code> <code> Deploying a Ruby on Rails application: an example Suppose you have a Rails application in /somewhere. Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public: <VirtualHost *:80> ServerName www.yourhost.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /somewhere/public <Directory /somewhere/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews </Directory> </VirtualHost> And that's it! You may also want to check the Users Guide for security and optimization tips, troubleshooting and other useful information: /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.19/doc/Users guide Apache.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) https://www.phusionpassenger.com Phusion Passenger is a trademark of Hongli Lai & Ninh Bui. </code> ===== 感想 ===== とにかく面倒だった…。 特にRubyのバージョン地獄が厄介(Redmineに限った話じゃないけど)。往年のDLL地獄も真っ青のヘルっぷり。初心者殺しもいいとこで、Rubyの敷居を揚げてる一因だと思う。 進んでRubyを使おうとは思わなくなったわ。 ===== 参考サイト ===== * [[http://www.redmine.org/projects/redmine/wiki/RedmineInstall|RedmineInstall - Redmine]] * [[http://blog.redmine.jp/articles/2_3/installation_centos/|Redmine 2.3をCentOS 6.4にインストールする手順 | Redmine.JP Blog]] * [[http://k-nightowl.net/?p=30|FreeBSD 9.0にRedmine 2.1.4をインストールする。 | k-nightowl.net]] * [[http://forums.freebsd.org/showthread.php?t=29662|FreeBSD 9.0 + Redmine + Ruby19 - The FreeBSD Forums]] ~~DISCUSSION~~ freebsd/freebsd_9.0-releaseにredmine_2.3.0をインストール.txt 最終更新: 2020-12-03 19:36by Decomo