freebsd:freebsd_9.0-releaseにredmine_2.3.0をインストール

FreeBSD 9.0RにRedmine 2.3.1をインストール

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無効でビルドしたバイナリ)
cd /usr/ports/databases/mysql56-server
sudo make install clean

サーバをインストールするとクライアントも一緒に入る。

起動する。

sudo echo 'mysql_enable="YES"' >> /etc/rc.conf
sudo /usr/local/etc/rc.d/mysql-server start

初めてのインストールなら、管理者パスワードを設定する。

sudo mysql
mysql> SET PASSWORD FOR root@localhost=PASSWORD('password');
mysql> exit

ruby本体は既に1.8.7が入っていたので、手っ取り早くそのまま使う。

新規にインストールするなら1.9系を入れた方がいいかも?

cd /usr/ports/converters/ruby-iconv/
sudo make install clean
cd /usr/ports/devel/ruby-gems
sudo make install clean

bundler

sudo gem install bundler
後の工程でbundlerで必要なGemが自動インストールされるようなので、手動で他のGemを入れる必要はないかもしれない。

Rails

sudo gem install rails -v 3.2.13

少々時間がかかる。-Vオプションで詳細情報が見られるので、付けておくと精神的に良いかもしれない。

mysql

sudo gem install mysql

Ruby 1.9だとmysql2になるっぽい。

インストール済みなので割愛

HDRIは無効にしないといけない(デフォルトは無効)。

cd /usr/ports/graphics/ImageMagick
sudo make install clean

ソースを持ってくる。

cd /usr/local/www
sudo svn co http://svn.redmine.org/redmine/branches/2.3-stable redmine

データベースを作る。

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';

設定ファイルをコピー

cd /usr/local/www/redmine/config
cp database.yml.example database.yml
cp configuration.yml.example configuration.yml

データベース接続設定ファイル(database.yml)をいじる。

production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: "redmine_password"
  encoding: utf8

必要なgemをインストール

sudo bundle install --without development test

秘密トークンを生成

cd /usr/local/www/redmine
sudo rake generate_secret_token

データベーススキーマを作成

sudo rake db:migrate RAILS_ENV=production

データベースにデフォルト値を設定

sudo rake redmine:load_default_data RAILS_ENV=production

パーミッション設定

# 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

PassengerでApacheから起動するようにする。

Passengerは3.0系列を使わないと上手く起動出来ないので、バージョン指定必須。どこにも書いてなくて超ハマった。

# gem install passenger --version 3.0.19

Apache用のモジュールをインストール

# 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!

ということなので、設定ファイルを作る。

/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>
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.

とにかく面倒だった…。

特にRubyのバージョン地獄が厄介(Redmineに限った話じゃないけど)。往年のDLL地獄も真っ青のヘルっぷり。初心者殺しもいいとこで、Rubyの敷居を揚げてる一因だと思う。

進んでRubyを使おうとは思わなくなったわ。

コメントを入力. Wiki文法が有効です:
 
  • freebsd/freebsd_9.0-releaseにredmine_2.3.0をインストール.txt
  • 最終更新: 2020-12-03 19:36
  • by Decomo