CentOS 6にRedmineをセットアップした備忘

さくらのVPS(v3) 2Gに乗り換えて、Redmine1.4をインストールして、Redmineのユーザでsubversionwebdavを認証するように設定した時に躓いたところの備忘。

やったこと

$ cat /etc/redhat-release
CentOS release 6.2 (Final)

rubyインスール

gitは既にインストールされていたので、rvmをインストールして、ruby1.9.3をインストール。
インストール時に"--with-openssl-dir"を指定しないと、あとでrake db:migrateするときに

rake aborted!
cannot load such file -- openssl

のエラーになった。

$ rpm -qa git
git-1.7.1-2.el6_0.1.x86_64
$ sudo curl -L get.rvm.io | bash -s stable
$ source ~/.rvm/scripts/rvm
$ rvm -v
rvm 1.12.3 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ rvm install 1.9.3 --with-openssl-dir=/usr/local
$ rvm list

rvm rubies

=* ruby-1.9.3-p125 [ x86_64 ]

Redmineからgmailsmtpでメール送信

Redmineのconfig/configuration.ymlに以下のように設定

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      tls: true
      enable_starttls_auto: true
      address: "smtp.gmail.com"
      port: 587
      domain: "smtp.gmail.com"
      authentication: :plain
      user_name: "gmail_acount@gmail.com"
      password: "password"

"enable_starttls_auto: true"を設定していないと、メール送信エラーになる。

log/production.log

The following error occured while sending email notification: "530 5.7.0 Must issue a STARTTLS command first.
Check your configuration in config/configuration.yml.

ruby1.9からはaction_mailer_optional_tlsのインストールは不要とのこと。

subversionWebDavの認証をRedmineに統合

mod_auth_mysqlを使うのだが、Remine1.2からsaltが追加されたため、mod_auth_mysqlにパッチを当ててからインストールする必要がある。

参照:CentOS6.2にredmine1.4をインストールしてSubversion連携(mod_auth_sqlのsalt対策)してみた | Kung Noi Blog


/etc/httpd/conf.d/svn.conf

<Location /svn>
    DAV           svn
    SVNParentPath /var/lib/svn
    AuthType      Basic
    AuthName      "Subversion Repository"
    Require       valid-user

    AuthMySQLEnable         On
    AuthMySQLSocket         /var/lib/mysql/mysql.sock
    AuthMySQLHost         localhost
    AuthMySQLUser           redmine
    AuthMySQLPassword        password
    AuthMySQLDB              redmine
    AuthMySQLUserTable       users
    AuthMySQLNameField       login
    AuthMySQLPasswordField  hashed_password
    AuthMySQLUserCondition "status=1"
    AuthMySQLSaltField salt
    AuthMySQLPwEncryption   sha1-rm
    AuthMySQLNoPasswd        Off
</Location>
$ mkdir /var/www/html/webdav
$ chown apache:apache /var/www/html/webdav

/etc/httpd/conf.d/webdav.conf
"Options Indexes"を設定しないと、アクセス時に403 Forbiddenになった。

<Location /webdav>
    Options Indexes
    DAV           on
    AuthType      Basic
    AuthName      "WebDav"
    Require       valid-user

    AuthMySQLEnable         On
    AuthMySQLSocket         /var/lib/mysql/mysql.sock
    AuthMySQLHost         localhost
    AuthMySQLUser           redmine
    AuthMySQLPassword        redmine
    AuthMySQLDB              password
    AuthMySQLUserTable       users
    AuthMySQLNameField       login
    AuthMySQLPasswordField  hashed_password
    AuthMySQLUserCondition "status=1"
    AuthMySQLSaltField salt
    AuthMySQLPwEncryption   sha1-rm
    AuthMySQLNoPasswd        Off
</Location>