目次



環境の構築

下記の通り順繰りやっていけばOK。

  1. CentOS 6.5 をインストール

  2. OS時刻の同期設定

  3. OpenSSLはyumで最新にする。
    2014/03/04現在は1.0.1e
    # rpm -q openssl
    openssl-1.0.1e-16.el6_5.4.i686

  4. OpenSSH 6.5p1(RPM)

  5. PostgreSQL 9.3(RPM)

    インストール後に下記。
    1. Redmine用ユーザーとDBの作成
      # su - postgres
      $ createuser -S -D -R redmine
      $ createdb redmine --owner=redmine --template=template0 --encoding='UTF-8' --lc-collate='C' --lc-ctype='C'

    2. pg_hba.confの編集
      $ vi /var/lib/pgsql/9.3/data/pg_hba.conf
      
      〜(略)〜
      # "local" is for Unix domain socket connections only
      local   all             all                                     peer   → trust に変更
      # IPv4 local connections:
      host    all             all             127.0.0.1/32            ident  → trust に変更
      # IPv6 local connections:
      host    all             all             ::1/128                 ident  → trust に変更

    3. pg_hba.confの編集後は再起動
      # /etc/rc.d/init.d/postgresql-9.3 restart

  6. Apache 2.2.26(RPM)

  7. Subversion 1.8.8(RPM)

  8. Ruby 2.0.0(RPM)
    最新の2.1.1を使用しようと思ったが、バグの情報があり2.0.0とした。

  9. 必要なものを yum でインストール
    # yum install -y libxml2 libxml2-devel libxslt libxslt-devel

Redmine のインストール

  1. ダウンロード
    # wget -P /usr/local/src http://www.redmine.org/releases/redmine-2.5.0.tar.gz

  2. 解凍
    # cd /usr/local/src
    # tar zxvf redmine-2.5.0.tar.gz

  3. 解凍したディレクトリを公開用ディレクトリに移動
    # mkdir /home/htdocs
    # mv redmine-2.5.0 /home/htdocs

  4. シンボリックリンク作成
    以下のようにしておくとサブディレクトリとしてRedmineにアクセスできる。
    # ln -s /home/htdocs/redmine-2.5.0 /home/htdocs/redmine 
    # ln -s /home/htdocs/redmine/public /var/www/htdocs/redmine

  5. 所有権変更
    これをやっておかないと「Internal Error」。
    # chown -R apache:apache /home/htdocs 
    # chown -R apache:apache /var/www/htdocs/redmine

  6. database.ymlの作成
    # cd /home/htdocs/redmine-2.5.0/config
    # vi database.yml
    以下を記述する。
    production:
      adapter: postgresql
      database: redmine
      host: localhost
      username: redmine
      password: "redmine"
      encoding: utf8

  7. configuration.ymlの作成
    # cd /home/htdocs/redmine-2.5.0/config
    # cp configuration.yml.example configuration.yml
    # vi configuration.yml
    環境に合わせて設定する。
    (例)メール環境
    # default configuration options for all environments
    default:
      # Outgoing emails configuration (see examples above)
      email_delivery:
        delivery_method: :smtp
        smtp_settings:
          address: smtp.hogehoge.com
          port: 25
          domain: hogehoge.com
          authentication: :login
          user_name: "redmine@hogehoge.com"
          password: "redmine"

    ※「POP before SMTP」でメール通知する場合は上記の設定ではメール通知できない。
    →参考:RedmineでPOP before SMTP で通知メールを送るための設定

  8. PostgreSQL用のGemをインストール
    # gem install pg -- --with-pg-config=/usr/pgsql-9.3/bin/pg_config
    Fetching: pg-0.17.1.gem (100%)
    Building native extensions with: '--with-pg-config=/usr/pgsql-9.3/bin/pg_config'
    This could take a while...
    Successfully installed pg-0.17.1
    invalid options: -f fivefish
    (invalid options are ignored)
    Parsing documentation for pg-0.17.1
    unable to convert "\xF0" from ASCII-8BIT to UTF-8 for lib/pg_ext.so, skipping
    Installing ri documentation for pg-0.17.1
    1 gem installed

  9. Redmineで使用するGemをインストール
    Redmineのインストールディレクトリで以下のコマンドを実行。
    # bundle install

    結果:
    Fetching gem metadata from https://rubygems.org/.........
    Fetching additional metadata from https://rubygems.org/..
    Resolving dependencies...
    Using rake (10.1.1)
    Using i18n (0.6.9)
    Using multi_json (1.9.0)
    Using activesupport (3.2.17)
    Using builder (3.0.0)
    Using activemodel (3.2.17)
    Using erubis (2.7.0)
    Using journey (1.0.4)
    Using rack (1.4.5)
    Using rack-cache (1.2)
    Using rack-test (0.6.2)
    Using hike (1.2.3)
    Using tilt (1.4.1)
    Using sprockets (2.2.2)
    Using actionpack (3.2.17)
    Using mime-types (1.25.1)
    Using polyglot (0.3.4)
    Using treetop (1.4.15)
    Using mail (2.5.4)
    Using actionmailer (3.2.17)
    Using arel (3.0.3)
    Using tzinfo (0.3.38)
    Using activerecord (3.2.17)
    Using activeresource (3.2.17)
    Using awesome_nested_set (2.1.6)
    Using bundler (1.5.3)
    Using mini_portile (0.5.2)
    Using nokogiri (1.6.1)
    Using xpath (2.0.0)
    Using capybara (2.1.0)
    Using ffi (1.9.3)
    Using childprocess (0.5.1)
    Using coderay (1.1.0)
    Using rack-ssl (1.3.3)
    Using json (1.8.1)
    Using rdoc (3.12.2)
    Using thor (0.18.1)
    Using railties (3.2.17)
    Using jquery-rails (2.0.3)
    Using metaclass (0.0.4)
    Using mocha (1.0.0)
    Using net-ldap (0.3.1)
    Using pg (0.17.1)
    Using ruby-openid (2.3.0)
    Using rack-openid (1.4.2)
    Using rails (3.2.17)
    Using redcarpet (2.3.0)
    Installing rmagick (2.13.2)
    Installing rubyzip (1.1.0)
    Installing websocket (1.0.7)
    Installing selenium-webdriver (2.40.0)
    Installing shoulda-context (1.0.2)
    Installing shoulda-matchers (1.4.1)
    Installing shoulda (3.3.2)
    Installing yard (0.8.7.3)
    Your bundle is complete!
    Use `bundle show [gemname]` to see where a bundled gem is installed. 

    ※Redmine 2.3より、bundlerは config/database.yml を参照して適切なデータベースアダプタをインストールするようになった為、2.2までのように --without オプションは必要はなし。

  10. 初期設定とデータベースのテーブル作成
    セッションデータ改竄防止用鍵の生成とテーブル作成を行う。
    Redmineのインストールディレクトリで以下のコマンドを実行。
    # bundle exec rake generate_secret_token
    # RAILS_ENV=production bundle exec rake db:migrate

  11. Passengerのインストール
    # gem install passenger --no-rdoc --no-ri

    結果:
    Fetching: daemon_controller-1.2.0.gem (100%)
    Successfully installed daemon_controller-1.2.0
    Fetching: passenger-4.0.37.gem (100%)
    Building native extensions.  This could take a while...
    Successfully installed passenger-4.0.37
    2 gems installed

  12. Apache用モジュールのインストール
    # passenger-install-apache2-module
    ※途中で下記のように環境チェックが行われ、not foundが無ければインストールされる。
    not foundがあると先に進めない。
    --------------------------------------------
    Checking for required software...
    
     * Checking for C compiler...
          Found: yes
          Location: /usr/bin/cc
     * Checking for C++ compiler...
          Found: yes
          Location: /usr/bin/c++
     * Checking for Curl development headers with SSL support...
          Found: yes
          curl-config location: /usr/bin/curl-config
          Header location: somewhere, not sure where
          Version: libcurl 7.19.7
          Usable: yes
          Supports SSL: yes
     * Checking for OpenSSL development headers...
          Found: yes
          Location: true
     * Checking for Zlib development headers...
          Found: yes
          Location: true
     * Checking for Apache 2...
          Found: yes
          Location of httpd: /usr/sbin/httpd
          Apache version: 2.2.26
     * Checking for Apache 2 development headers...
          Found: yes
          Location of apxs2: /usr/sbin/apxs
     * Checking for Rake (associated with /usr/bin/ruby)...
          Found: yes
          Location: /usr/bin/ruby /usr/bin/rake
     * Checking for OpenSSL support for Ruby...
          Found: yes
     * Checking for RubyGems...
          Found: yes
     * Checking for Ruby development headers...
          Found: yes
          Location: /usr/include/ruby/ruby-2.0.0/ruby.h
     * Checking for rack...
          Found: yes
     * Checking for Apache Portable Runtime (APR) development headers...
          Found: yes
          Location: /usr/bin/apr-1-config
          Version: 1.5.0
     * Checking for Apache Portable Runtime Utility (APU) development headers...
          Found: yes
          Location: /usr/bin/apu-1-config
          Version: 1.5.3
    
    --------------------------------------------
    
    Sanity checking Apache installation...
    All good!
    
    --------------------------------------------

    インストールが完了した際に表示されるPassenger用のApache設定を保存しておく。
    Almost there!
    
    Please edit your Apache configuration file, and add these lines:
    
       LoadModule passenger_module /usr/lib/ruby/gems/2.0.0/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
       <IfModule mod_passenger.c>
         PassengerRoot /usr/lib/ruby/gems/2.0.0/gems/passenger-4.0.37
         PassengerDefaultRuby /usr/bin/ruby
       </IfModule>
    
    After you restart Apache, you are ready to deploy any number of web
    applications on Apache, with a minimum amount of configuration!

  13. Apacheの設定
    Passenger用の設定ファイルを作成する。
    # cd /etc/httpd/conf/extra/
    # vi httpd-passenger.conf
    以下を記述。 (※以下の行は直前に表示されていた設定)
      LoadModule passenger_module /usr/lib/ruby/gems/2.0.0/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
      <IfModule mod_passenger.c>
        PassengerRoot /usr/lib/ruby/gems/2.0.0/gems/passenger-4.0.37
        PassengerDefaultRuby /usr/bin/ruby
      </IfModule>
    
    RailsBaseURI /redmine
    Passenger用の設定ファイルをインクルード。
    # vi /etc/httpd/conf/httpd.conf
    
    以下の記述を追記。
    Include conf/extra/httpd-passenger.conf

  14. Apache再起動
    # /etc/rc.d/init.d/httpd restart
    httpd を停止中:                                            [  OK  ]
    httpd を起動中:                                            [  OK  ]

設定、等

  1. これをしないと[管理]-[情報]ページで『Plugin assetsディレクトリに書き込み可能』に!マークが付いたままになる。
    # chown -R apache:apache /home/htdocs/redmine/public/plugin_assets

  2. Redmineからの通知メール設定でPOPbeforeSMTP認証の場合の対応

    RedmineでPOP before SMTP で通知メールを送るための設定を参照。

プラグイン導入


Redmineのプラグインのインストールに使用するGitをインストールしておく。

# yum install git


プラグインのインストールはpluginsディレクトリにプラグインを展開するだけだが、DBを使用するプラグインでは下記の実行が必要。

# rake redmine:plugins:migrate RAILS_ENV=production

DBを使用しないプラグインでも上記コマンドによる影響はないので、インストール後は毎回上記コマンドを実行しとけばOK。

Redmine HTTP Basic Authentication

Basic認証でRedmineにログインできるようになる。
インストールしてHttpdを再起動するとプラグインがデフォルトで有効になり、RedmineユーザーにBasic認証ユーザーと同じ名前が登録されていないと何も出来なくなる。
前以ってBasic認証ユーザーと同じ名前のRedmine管理者を登録しておく必要がある。
(調べてないので詳細は不明だが、Redmine管理者をインストール前に作っておくのが楽。)

Redmine Code Review plugin

リポジトリ表示からコードレビューを追加できる。
(参考:r-labs - Code Review


トップ   編集 凍結解除 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-05-10 (水) 20:53:57