文書の過去の版を表示しています。
FreeBSD 9.0-RELEASEにRedmine 2.3.1をインストール
必要なものを揃える
Installing Redmineに、Redmineのインストールに必要な環境が書いてあるので準備する。
今回用意した環境。
- ruby 1.8.7
- Rails 3.2.13
- RubyGems 1.8.25
- MySQL 5.6.11
- Subversion 1.7.3
- ImageMagick 6.8.0.7
MySQL
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
ruby本体は既に1.8.7が入っていたので、手っ取り早くそのまま使う。
新規にインストールするなら1.9系を入れた方がいいかも?
cd /usr/ports/converters/ruby-iconv/ sudo make install clean
RubyGems
cd /usr/ports/devel/ruby-gems sudo make install clean
bundler
sudo gem install bundler
mysql
sudo gem install mysql
ruby 1.9だとmysql2になるっぽい。
Rails
sudo gem install rails -v 3.2.13
少々時間がかかる。-Vオプションで詳細情報が見られるので、付けておくと精神的に良いかもしれない。
Subversion
インストール済みなので割愛
ImageMagick
cd /usr/ports/graphics/ImageMagick sudo make install clean
Redmineのインストール
ソースを持ってくる。
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 postgresql sqlite
秘密トークンを生成
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
sudo pw groupadd -n redmine -g 20000 sudo pw useradd -n redmine -u 20000 -g 20000 -d /usr/local/www/redmine/ -s /sbin/nologin -h -
sudo mkdir tmp tmp/pdf public/pluin_assets sudo chown -R redmine:redmine files log tmp public/pluin_assets sudo chmod -R 755 files log tmp public/pluin_assets
自動起動の設定
PassengerでApacheから起動するようにする。
Passengerは3.0系列を使わないと上手く起動出来ないので、バージョン指定必須。どこにも書いてなくて超ハマった。
sudo gem install passenger --version 3.0.19
sudo 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!
Press ENTER to continue.
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.
コメント