概要:Redmineをインストールする。

前提:

  • Ruby
  • Ruby on Rails
  • MySQL

1. Redmineのダウンロード & インストール

# cd /tmp/work
# wget http://rubyforge.org/frs/download.php/68872/redmine-0.9.1.tar.gz ← Redmineダウンロード
注:最新版のURLはダウンロードページ[ http://rubyforge.org/frs/?group_id=1850 ]で確認すること。
# tar zxvf redmine-0.9.1.tar.gz ← Redmine展開
# cp -pR redmine-0.9.1 /var/lib/redmine ← Redmineのインストール
# chown -R root. /var/lib/redmine

2. データベースの設定

  1. ) Redmine用データベース作成
    # mysql -u root -p ← MySQLへrootでログイン。
    Enter password:  ← MySQLのrootパスワードを入力。
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 21 to server version: 3.23.58
    
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    
    mysql> create database redmine; ← redmineデータベース作成。
    Query OK, 1 row affected (0.01 sec)
    
    mysql> grant all privileges on redmine.* to dbadmin@localhost identified by 'パスワード';
     ← redmineデータベースへの全てのアクセス権限を持った、新規ユーザdbadminを登録。
    
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> exit ← ログアウト
    Bye
    
    # mysql -u dbadmin -pdbadmin redmine ← dbadminユーザでredmineデータベースに接続できることを確認。
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 22 to server version: 3.23.58
    
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    
    mysql> exit ← ログアウト
    Bye
    
  2. ) Redmine用データベース作成
    # cp /var/lib/redmine/config/database.yml.example /var/lib/redmine/config/database.yml
    # vi /var/lib/redmine/config/database.yml
    productionの以下の部分を変更して、production以外は削除する。
    production:
      adapter: mysql
      database: redmine
      host: localhost
      username: root ← 上記で作成したユーザーを設定
      password: xxxxxxxxxx ← パスワードを設定
      encoding: utf8
    
  3. ) セッション暗号化用鍵の生成
    下記コマンドでconfig/initializers/session_store.rbを生成する。
    # cd /var/lib/redmine
    # rake config/initializers/session_store.rb
    (in /var/lib/redmine)
    
  4. ) Redmine用テーブルの作成
    # cd /var/lib/redmine
    # rake db:migrate RAILS_ENV=production
    (in /var/lib/redmine)
    ==  Setup: migrating ==========================================================
    -- create_table("attachments", {:force=>true})
       -> 0.0893s
    -- create_table("auth_sources", {:force=>true})
       -> 0.0062s
       :
       :
    ==  ChangeWikiContentsTextLimit: migrating ====================================
    -- change_column(:wiki_contents, :text, :text, {:limit=>16777216})
       -> 0.0106s
    -- change_column(:wiki_content_versions, :data, :binary, {:limit=>16777216})
       -> 0.0116s
    ==  ChangeWikiContentsTextLimit: migrated (0.0228s) ===========================
    
  5. ) 初期データのセットアップ
    # rake redmine:load_default_data RAILS_ENV="production"
    (in /var/lib/redmine)
    
    Select language: bg, bs, ca, cs, da, de, el, en, es, fi, fr, gl, he, hr, hu, id, it, ja, k
    o, lt, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sr, sv, th, tr, uk, vi, zh, zh-TW [en] ja
    ====================================
    Default configuration data loaded.
    

3. 稼動確認
付属Webサーバで起動してみる。

# cd /var/lib/redmine
# script/server -e production
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::
Dependency#version_requirements is deprecated and will be removed on or after August 2010.
  Use #requirement
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-05-09 03:34:55] INFO  WEBrick 1.3.1
[2010-05-09 03:34:55] INFO  ruby 1.8.7 (2010-01-10) [i686-linux]
[2010-05-09 03:34:55] INFO  WEBrick::HTTPServer#start: pid=6062 port=3000
ポート3000番で起動されているので、http://ホスト名:3000/ にアクセスする。
初期管理者ユーザadmin、パスワードadminを入力してログインする。
停止はコンソールに表示されているように Ctrl-Cで停止する。
    :
    :
[2010-05-09 03:51:30] INFO  going to shutdown ...
[2010-05-09 03:51:30] INFO  WEBrick::HTTPServer#start done.
Exiting

4. ApacheからRedmineを動かす

  1. ) Phusion Passengerのgemでのインストール
    # gem install passenger
    Building native extensions.  This could take a while...
    Building native extensions.  This could take a while...
    Successfully installed fastthread-1.0.7
    Successfully installed passenger-2.2.11
    2 gems installed
    Installing ri documentation for fastthread-1.0.7...
    
    No definition for dummy_dump
    
    No definition for dummy_dump
    
    No definition for rb_queue_marshal_load
    
    No definition for rb_queue_marshal_dump
    
    No definition for dummy_dump
    
    No definition for dummy_dump
    
    No definition for rb_queue_marshal_load
    
    No definition for rb_queue_marshal_dump
    Installing ri documentation for passenger-2.2.11...
    Installing RDoc documentation for fastthread-1.0.7...
    
    No definition for dummy_dump
    
    No definition for dummy_dump
    
    No definition for rb_queue_marshal_load
    
    No definition for rb_queue_marshal_dump
    
    No definition for dummy_dump
    
    No definition for dummy_dump
    
    No definition for rb_queue_marshal_load
    
    No definition for rb_queue_marshal_dump
    Installing RDoc documentation for passenger-2.2.11...
    
  2. ) Passengerのインストール(1回目)
    # passenger-install-apache2-module
    Welcome to the Phusion Passenger Apache 2 module installer, v2.2.11.
    
    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.
    
    
    --------------------------------------------
    
    Checking for required software...
    
     * GNU C++ compiler... found at /usr/bin/g++
     * Ruby development headers... found
     * OpenSSL support for Ruby... found
     * RubyGems... found
     * Rake... found at /usr/local/bin/rake
     * rack... found
     * Apache 2... found at /usr/sbin/httpd
     * Apache 2 development headers... not found
     * Apache Portable Runtime (APR) development headers... not found
     * Apache Portable Runtime Utility (APU) development headers... not found
    
    Some required software is not installed.
    But don't worry, this installer will tell you how to install them.
    
    Press Enter to continue, or Ctrl-C to abort.
    
    --------------------------------------------
    
    Installation instructions for required software
    
     * To install Apache 2 development headers:
       Please run yum install httpd-devel as root.
    
     * To install Apache Portable Runtime (APR) development headers:
       Please run yum install apr-devel as root.
    
     * To install Apache Portable Runtime Utility (APU) development headers:
       Please download it from http://httpd.apache.org/
       (APR Utility is an integrated part of Apache.)
    
    If the aforementioned instructions didn't solve your problem, then please take
    a look at the Users Guide:
    
      /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11/doc/Users guide Apache.html
    
  3. ) 不足パッケージのインストール 上記の結果httpd-devel、apr-devel、APR Utility development headers(apr-util-devel)をインストールする。
    # yum -y install httpd-devel apr-devel apr-util-devel
    
  4. ) Passengerのインストール(2回目)
    # gem install passenger
    Building native extensions.  This could take a while...
    Successfully installed passenger-2.2.11
    1 gem installed
    Installing ri documentation for passenger-2.2.11...
    Installing RDoc documentation for passenger-2.2.11...
    
  5. ) Apacheモジュールのビルドとインストール
    passenger-install-apache2-moduleを実行し、Apacheモジュールのビルドとインストールを行う。
    # passenger-install-apache2-module
    Welcome to the Phusion Passenger Apache 2 module installer, v2.2.11.
    
    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.
    
    
    --------------------------------------------
    
    Checking for required software...
    
     * GNU C++ compiler... found at /usr/bin/g++
     * Ruby development headers... found
     * OpenSSL support for Ruby... found
     * RubyGems... found
     * Rake... found at /usr/local/bin/rake
     * rack... found
     * Apache 2... found at /usr/sbin/httpd
     * Apache 2 development headers... found at /usr/sbin/apxs
     * Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config
     * Apache Portable Runtime Utility (APU) development headers... found at /usr/bin/apu-1-config
    
    --------------------------------------------
    Compiling and installing Apache 2 module...
    cd /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
    /usr/local/bin/ruby -S /usr/local/bin/rake clean apache2
    # /usr/local/bin/ruby -S /usr/local/bin/rake clean apache2
      :
      :
      :
    --------------------------------------------
    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-2.2.1
    1/ext/apache2/mod_passenger.so
       PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
       PassengerRuby /usr/local/bin/ruby
    
    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
          DocumentRoot /somewhere/public    # <-- be sure to point to 'public'!
          <Directory /somewhere/public>
             AllowOverride all              # <-- relax Apache security settings
             Options -MultiViews            # <-- MultiViews must be turned off
          </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-2.2.11/doc/Users guide Apache.html
    
    Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
    http://www.modrails.com/
    
    Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
    
  6. ) Apacheの設定
    アクセス先がhttp://ドメイン名/redmine/というように複数のアプリケーションをサブディレクトリーでアクセスできるように、バーチャルホストではなくリンクで設定する。
    # vi /etc/httpd/conf.d/passenger.conf ← 新規作成
    
    LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
    PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
    PassengerRuby /usr/local/bin/ruby
    
    以下をアプリケーション毎に設定する。
    # vi /etc/httpd/conf.d/rails_apps.conf ← 新規作成
    RailsBaseURI /redmine
    
  7. ) SELinuxの設定
    httpd下でPassengerが/tmpディレクトリーにファイルを作成できるようにする。
    # setsebool -P httpd_disable_trans=1
    
  8. ) リンクの設定
    Apacheから起動できるようにRedmineの公開先にリンクをはる。
    # ln -s /var/lib/redmine/public /var/www/html/redmine
    
  9. ) Apache設定反映
    # /etc/rc.d/init.d/httpd reload ← 設定再読込み
    httpd を再読み込み中:                                      [  OK  ]
    
  10. ) 稼動確認
    http://ホスト名/redmine にアクセスする。
    redmineのHPが表示されればOK。

最終更新のRSS
Last-modified: 2014-03-11 (火) 01:59:57 (1841d)