ラベル Redmine の投稿を表示しています。 すべての投稿を表示
ラベル Redmine の投稿を表示しています。 すべての投稿を表示

2014年10月30日木曜日

Redmine 2.6.0へアップグレード

redmine 2.5.3を2.6.0へアップグレード(tarボール版)

不満のあったPDFエクスポートが改善されたようなので2.6へアップしてみました。
でも2.6.1がすぐリリースされそうな予感ですが・・・

手順は以前アップグレードした時と同じです。

OS:CentOS 6.4
DB:PostgreSQL9.2.3
redmine:/home/redmine/public_html/
※プラグインは一切に使用していない

ruby:1.9.3p392
gem:1.8.23

●現在のGemList

# gem list --local

*** LOCAL GEMS ***

actionmailer (3.2.19, 3.2.17, 3.2.13)
actionpack (3.2.19, 3.2.17, 3.2.13)
activemodel (3.2.19, 3.2.17, 3.2.13)
activerecord (3.2.19, 3.2.17, 3.2.13)
activeresource (3.2.19, 3.2.17, 3.2.13)
activesupport (3.2.19, 3.2.17, 3.2.13)
arel (3.0.3, 3.0.2)
awesome_nested_set (2.1.6)
bigdecimal (1.1.0)
builder (3.0.0)
bundler (1.3.4)
capybara (2.1.0)
childprocess (0.5.3)
coderay (1.1.0, 1.0.9)
daemon_controller (1.1.2)
erubis (2.7.0)
fastthread (1.0.7)
ffi (1.9.3)
hike (1.2.3, 1.2.2, 1.2.1)
i18n (0.6.11, 0.6.9, 0.6.1)
io-console (0.3)
journey (1.0.4)
jquery-rails (2.0.3)
json (1.8.1, 1.8.0, 1.7.7, 1.5.5)
mail (2.5.4, 2.5.3)
metaclass (0.0.4)
mime-types (1.25.1, 1.23, 1.21)
mini_portile (0.5.3)
minitest (2.5.1)
mocha (1.0.0)
multi_json (1.10.1, 1.10.0, 1.7.7, 1.7.3, 1.7.2)
net-ldap (0.3.1)
nokogiri (1.6.1)
passenger (3.0.19)
pg (0.17.1, 0.15.1, 0.15.0)
polyglot (0.3.5, 0.3.4, 0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-openid (1.4.2, 1.3.1)
rack-ssl (1.3.4, 1.3.3)
rack-test (0.6.2)
rails (3.2.19, 3.2.17, 3.2.13)
railties (3.2.19, 3.2.17, 3.2.13)
rake (10.1.1, 10.1.0, 10.0.4, 0.9.2.2)
rdoc (3.12.2, 3.9.5)
redcarpet (2.3.0)
rmagick (2.13.3, 2.13.2)
ruby-openid (2.3.0, 2.1.8)
rubyzip (1.1.3)
selenium-webdriver (2.41.0)
shoulda (3.3.2)
shoulda-context (1.0.2)
shoulda-matchers (1.4.1)
sprockets (2.2.2)
thor (0.19.1, 0.18.1, 0.18.0)
tilt (1.4.1, 1.4.0, 1.3.6)
treetop (1.4.15, 1.4.14, 1.4.12)
tzinfo (0.3.42, 0.3.39, 0.3.37)
websocket (1.0.7)
xpath (2.0.0)
yard (0.8.7.4)


●DBバックアップ
dbname:redmine(-U でdbuser指定), dbuser:redmine, バックアップはredmineのソースディレクトリに保存(db_日付.dumpで作成)

# /usr/local/pgsql/bin/pg_dump -U redmine -Fc redmine > /home/redmine/public_html/db_`date +%Y%m%d`.dump

●redmineのバックアップと2.6.0用ディレクトリの作成
public_htmlをpublic_html_253でバックアップ

# mv /home/redmine/public_html /home/redmine/public_html_253
# mkdir /home/redmine/public_html
# chmod 775 /home/redmine/public_html

redmine2.6.0のダウンロード
ソース解凍後に2.6.0用ディレクトリにソースを移動

# cd /usr/local/src/
# wget http://www.redmine.org/releases/redmine-2.6.0.tar.gz
# tar zxvf redmine-2.6.0.tar.gz
# mv ./redmine-2.6.0/* /home/redmine/public_html/

●設定ファイル等のコピー
追加したfarend_fancyというテーマも移行します。

# cd /home/redmine/public_html_253/
# cp ./config/database.yml /home/redmine/public_html/config/
# cp ./config/additional_environment.rb /home/redmine/public_html/config/
# cp -rf ./files/* /home/redmine/public_html/files/
# cp -r ./public/themes/farend_fancy /home/redmine/public_html/public/themes/

私はプラグインを使用していないため移行作業はありませんが移行するならば
# cp -r ./plugins/* /home/redmine/public_html/plugins/

ただし新バージョンでは動作しないことも考えられるためスムーズに移行できるとは限らない。redmine2.6に対応したバージョンがリリースされているか事前にチェックした方が良さそうです。

今はプラグインはここかな?
# mkdir ./public/plugin_assets

# cp -r /home/redmine/public_html_252/public/plugin_assets /home/redmine/public_html/public/plugin_assets

依存Gem関連のインストール
redmineはGemの依存管理をBundlerが行っているためBundlerをインストールしておく

# gem install bundler

# cd /home/redmine/public_html
# bundle install --without development test mysql sqlite sqlserver
(ImageMagickがインストールされていない場合はオプションにrmagic付加すればよい)

Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Installing rake (10.3.2) 
Using i18n (0.6.11) 
Using multi_json (1.10.1) 
Using activesupport (3.2.19) 
Installing builder (3.0.4) 
Using activemodel (3.2.19) 
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.19) 
Using mime-types (1.25.1) 
Using polyglot (0.3.5) 
Using treetop (1.4.15) 
Using mail (2.5.4) 
Using actionmailer (3.2.19) 
Using arel (3.0.3) 
Using tzinfo (0.3.42) 
Using activerecord (3.2.19) 
Using activeresource (3.2.19) 
Using bundler (1.3.4) 
Using coderay (1.1.0) 
Using rack-ssl (1.3.4) 
Using json (1.8.1) 
Using rdoc (3.12.2) 
Using thor (0.19.1) 
Using railties (3.2.19) 
Installing jquery-rails (3.1.2) 
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.19) 
Installing rbpdf (1.18.2) 
Using redcarpet (2.3.0) 
Installing request_store (1.0.5) 
Using rmagick (2.13.3) 


●仕上げ


# rake generate_secret_token

# rake db:migrate RAILS_ENV=production

==  AddPasswordChangedAtToUser: migrating =====================================
-- add_column(:users, :passwd_changed_on, :datetime)
   -> 0.0587s
==  AddPasswordChangedAtToUser: migrated (0.0588s) ============================

==  InsertBuiltinGroups: migrating ============================================
==  InsertBuiltinGroups: migrated (0.7091s) ===================================

# rake redmine:plugins:migrate RAILS_ENV=production
# rake tmp:cache:clear
# rake tmp:sessions:clear

# chown -R daemon:daemon /home/redmine/public_html
# /usr/local/apache/bin/apachectl restart

データベースに大きな変更は無いようですね。
usersにパスワード変更日のようなフィールドが追加されたぐらいですかね。


Redmineの管理>情報
Environment:
  Redmine version                2.6.0.stable
  Ruby version                   1.9.3-p392 (2013-02-22) [i686-linux]
  Rails version                  3.2.19
  Environment                    production
  Database adapter               PostgreSQL
SCM:
  Subversion                     1.6.11
  Git                            1.7.1
  Filesystem                     
Redmine plugins:
  no plugin installed

チケットの一覧をPDFで出力すると列幅が小さく見ずらい状態でしたが幅が広がり見やすくなりましたね。







2014年5月9日金曜日

Redmine 2.5.1へアップグレード

以前こちらで、アップグレードしたRedmine2.3系を2.5.1へアップグレード

ちなみに環境はCentOS6.4+PostgreSQL9.2+Apache+Passenger

●DBバックアップ
# /usr/local/pgsql/bin/pg_dump -U [dbuser] -Fc [dbname] > /home/redmine/public_html/db_`date +%Y%m%d`.dump

●旧Redmineのバックアップと新ディレクトリの作成
# mv /home/redmine/public_html /home/redmine/public_html_v232

# mkdir /home/redmine/public_html
# chmod 775 /home/redmine/public_html

●Redmineダウンロード
# cd /usr/local/src
# wget http://www.redmine.org/releases/redmine-2.5.1.tar.gz
# tar zxvf redmine-2.5.1.tar.gz
# mv ./redmine-2.5.1/* /home/redmine/public_html/

●設定ファイル等を移動
# cd /home/redmine/public_html_232/
# cp ./config/database.yml /home/redmine/public_html/config/
# cp ./config/configuration.yml /home/redmine/public_html/config/
# cp ./config/additional_environment.rb /home/redmine/public_html/config/
# cp -rf ./files/* /home/redmine/public_html/files/

テーマのfarend_fancyは最新にするため不要
# cp -r ./public/themes/farend_fancy /home/redmine/public_html/public/themes/

プラグインを使用していないため不要
# cp -r ./plugins/* /home/redmine/public_html/plugins/

●テーマ(farend_fancy)を最新へ
# cd /usr/local/src
# wget https://github.com/farend/redmine_theme_farend_fancy/archive/master.tar.gz
# tar zxvf master
# mv ./redmine_theme_farend_fancy-master/ ./farend_fancy
# cp -r ./farend_fancy /home/redmine/public_html/public/themes/

●PostreSQL用アダプタの追加インストール(ver.0.17.1)
# cd /home/redmine/public_html
# gem install pg -v '0.17.1' -- --with-pg-config=/usr/local/pgsql/bin/pg_config --no-rdoc --no-ri
Fetching: pg-0.17.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed pg-0.17.1
1 gem installed
Installing ri documentation for pg-0.17.1...
Installing RDoc documentation for pg-0.17.1...

●Gemfileに従い依存ソフトのインストール
# cd /home/redmine/public_html

mysql不要でオプション指定しているが何故かMySQL用アダプターで怒られる・・・
database.ymlファイル内のproduction:項目以外はコメントにしてみたらOKだった

# bundle install --without development test mysql sqlite
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.1)
Using i18n (0.6.9)
Using multi_json (1.10.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.39)
Using activerecord (3.2.17)
Using activeresource (3.2.17)
Using awesome_nested_set (2.1.6)
Using bundler (1.2.3)
Using coderay (1.1.0)
Using rack-ssl (1.3.4)
Using json (1.8.1)
Using rdoc (3.12.2)
Using thor (0.19.1)
Using railties (3.2.17)
Using jquery-rails (2.0.3)
Using net-ldap (0.3.1)
Using pg (0.17.1)
Installing ruby-openid (2.3.0)
Installing rack-openid (1.4.2)
Installing rails (3.2.17)
Installing redcarpet (2.3.0) with native extensions
Using rmagick (2.13.2)
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.

●仕上げ
# rake generate_secret_token
# rake db:migrate RAILS_ENV=production
==  CreateQueriesRoles: migrating =============================================
-- create_table(:queries_roles, {:id=>false})
   -> 0.0874s
-- add_index(:queries_roles, [:query_id, :role_id], {:unique=>true, :name=>:queries_roles_ids})
   -> 0.0161s
==  CreateQueriesRoles: migrated (0.1036s) ====================================

==  AddQueriesVisibility: migrating ===========================================
-- add_column(:queries, :visibility, :integer, {:default=>0})
   -> 0.0473s
-- remove_column(:queries, :is_public)
   -> 0.0009s
==  AddQueriesVisibility: migrated (0.0941s) ==================================

==  CreateCustomFieldsRoles: migrating ========================================
-- create_table(:custom_fields_roles, {:id=>false})
   -> 0.0008s
-- add_index(:custom_fields_roles, [:custom_field_id, :role_id], {:unique=>true, :name=>:custom_fields_roles_ids})
   -> 0.0030s
==  CreateCustomFieldsRoles: migrated (0.0177s) ===============================

==  AddQueriesOptions: migrating ==============================================
-- add_column(:queries, :options, :text)
   -> 0.0005s
==  AddQueriesOptions: migrated (0.0005s) =====================================

==  AddUsersMustChangePasswd: migrating =======================================
-- add_column(:users, :must_change_passwd, :boolean, {:default=>false, :null=>false})
   -> 0.0121s
==  AddUsersMustChangePasswd: migrated (0.0122s) ==============================

==  RemoveEolsFromAttachmentsFilename: migrating ==============================
==  RemoveEolsFromAttachmentsFilename: migrated (0.1646s) =====================

==  SupportForMultipleCommitKeywords: migrating ===============================
==  SupportForMultipleCommitKeywords: migrated (0.0543s) ======================

==  AddRepositoriesCreatedOn: migrating =======================================
-- add_column(:repositories, :created_on, :timestamp)
   -> 0.0008s
==  AddRepositoriesCreatedOn: migrated (0.0008s) ==============================

==  AddCustomFieldsFormatStore: migrating =====================================
-- add_column(:custom_fields, :format_store, :text)
   -> 0.0011s
==  AddCustomFieldsFormatStore: migrated (0.0012s) ============================

==  AddCustomFieldsDescription: migrating =====================================
-- add_column(:custom_fields, :description, :text)
   -> 0.0006s
==  AddCustomFieldsDescription: migrated (0.0007s) ============================

==  RemoveCustomFieldsMinMaxLengthDefaultValues: migrating ====================
-- change_column(:custom_fields, :min_length, :int, {:default=>nil, :null=>true})
   -> 0.0108s
-- change_column(:custom_fields, :max_length, :int, {:default=>nil, :null=>true})
   -> 0.0016s
==  RemoveCustomFieldsMinMaxLengthDefaultValues: migrated (0.0142s) ===========

==  StoreRelationTypeInJournalDetails: migrating ==============================
==  StoreRelationTypeInJournalDetails: migrated (0.0124s) =====================

==  DeleteOrphanTimeEntriesCustomValues: migrating ============================
==  DeleteOrphanTimeEntriesCustomValues: migrated (0.0314s) ===================

==  ChangeChangesetsCommentsLimit: migrating ==================================
==  ChangeChangesetsCommentsLimit: migrated (0.0000s) =========================

# rake redmine:plugins:migrate RAILS_ENV=production
# rake tmp:cache:clear
# rake tmp:sessions:clear
# chown -R daemon:daemon /home/redmine/public_html





おしまい

2013年5月8日水曜日

Redmine2.3.1へアップグレード

以前構築した2.3.0を2.3.1へアップグレードした。

環境は以下の通り(Web,DB,Rubyはソースからインストール)

  • OS:CentOS 6.4(32bit)
  • Web:Apache 2.2.4(/usr/local/apache)+Passenger実行
  • DB:PostgreSQL 9.2.3(/usr/local/pgsql)
  • Ruby:1.9.3-p392
  • Redmine:/home/redmine/public_html (tarボールから)
環境の構築はこちら

バージョンアップの注意!
Redmine2.3.1よりpg-1.15.1(2.3.0では1.15.0であった)が必要となるため事前にアップしておきます。忘れるとbundle install 時、以下のエラーとなります。

エラー内容
An error occurred while installing pg (0.15.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.15.1'` succeeds before bundling.
[root@localhost public_html]# gem install pg -v '0.15.1'
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.


libpq-fe.h headerが見つけられるようpg_configへのパスを指定してpgをインストールします。
with-pg-configはサーバ環境に合わせます。

# gem install pg -v '0.15.1' -- --with-pg-config=/usr/local/pgsql/bin/pg_config --no-rdoc --no-ri

Fetching: pg-0.15.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed pg-0.15.1
1 gem installed
Installing ri documentation for pg-0.15.1...
Installing RDoc documentation for pg-0.15.1...


もしエラーになる場合は以下のようにすれば大丈夫かも
# gem install pg -v '0.15.1' -- --with-pg-config=/usr/local/pgsql/bin/pg_config --with-pg-dir=/usr/local/pgsql/ --with-pg-lib=/usr/local/pgsql/lib/ --with-pg-include=/usr/local/pgsql/include/ --no-rdoc --no-ri


あれ?ドキュメントは不要とオプション指定しているのにインストールされてるような・・・まっいいや

ちなみにパスが正しく通っていないと以下のようにエラーとなります。

エラー内容
# gem install pg -v '0.15.1'
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
(ヘッダ情報が不足しておりMakefileが作れない、詳しくはmkmf.logを参照)

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby
        --with-pg
        --without-pg
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config

Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/pg-0.15.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/pg-0.15.1/ext/gem_make.out
となってしまいます。


インストールを確認
# gem list --local
pg (0.15.1, 0.15.0)のように0.15.1を確認します。


では、アップグレード開始です。

2013年3月27日水曜日

CentOS6にRedmine2.3&PostgreSQL9.2

Redmine+PosgtreSQL+Apache+Passenger
  • Redmine:2.3.0
  • OS:  CentOS-6.4(x86) Minimal構成
  • Web: Apache-2.2.24(ソースから) Passenger実行
  • DB:  PostgreSQL-9.2.3(ソースから)
  • Ruby: Ruby1.9.3-p392(ソースから)
  • Rails: 3.2.13(Ruby同梱)

OSのインストール

ここでは構築手順を割愛させて頂きますが以下で構築したものをベースにしております。
CentOS6をVMwareにテキストモードでインストールしたもので参考になるかと思います。
http://stdman.blogspot.jp/2011/12/centos6.html

構成内容(
・IPv6:OFF
・パッケージ群:Base,Development Tools
・有効サービス:crond,iptables,network,ntpd,postfix,rsyslog,sshd,cpuspeed,irqbalance
・FireWall:OFF
・SELinux:OFF

●必要パッケージやリポジトリをインストール

Rubyのビルドで必要なEPELリポジトリのインストール
http://ftp.riken.jp/Linux/fedora/epel/6/i386/repoview/epel-release.htmlからRPMのダウンロード先リンクを取得します。
 
# rpm -Uvh http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

Retrieving http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.ZZztWP: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

EPELレポジトリのGPGキーのインポート
# rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
 
EPELレポジトリのGPGキーの確認
# rpm -q 'gpg-pubkey-*' --qf '%{name} -> %{summary}\n'
gpg-pubkey -> gpg(CentOS-6 Key (CentOS 6 Official Signing Key) )
gpg-pubkey -> gpg(EPEL (6) )


開発パッケージをインストール
# yum groupinstall "Development Tools"

その他必要なパッケージをインストール(PostgreSQL用)
# yum install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel ImageMagick ImageMagick-devel ipa-pgothic-fonts
※libyamlとlibyaml-develがEPELレポジトリから取得されました

依存関係により以下のパッケージも一緒にインストールされました

GConf2.i686 0:2.28.0-6.el6
ORBit2.i686 0:2.14.17-3.2.el6_3
bzip2-devel.i686 0:1.0.5-7.el6_0
fontpackages-filesystem.noarch 0:1.41-1.1.el6
freetype-devel.i686 0:2.3.11-14.el6_3.1
ghostscript.i686 0:8.70-15.el6_4.1
ghostscript-devel.i686 0:8.70-15.el6_4.1
ghostscript-fonts.noarch 0:5.50-23.1.el6
jasper-devel.i686 0:1.900.1-15.el6_1.1
keyutils-libs-devel.i686 0:1.4-4.el6
krb5-devel.i686 0:1.10.3-10.el6_4.1
lcms-devel.i686 0:1.19-1.el6
lcms-libs.i686 0:1.19-1.el6
libICE-devel.i686 0:1.0.6-1.el6
libIDL.i686 0:0.8.13-2.1.el6
libSM-devel.i686 0:1.2.1-2.el6
libX11-devel.i686 0:1.5.0-4.el6
libXau-devel.i686 0:1.0.6-4.el6
libXext-devel.i686 0:1.3.1-2.el6
libXfont.i686 0:1.4.5-2.el6
libXt.i686 0:1.1.3-1.el6
libXt-devel.i686 0:1.1.3-1.el6
libcom_err-devel.i686 0:1.41.12-14.el6
libcroco.i686 0:0.6.2-5.el6
libfontenc.i686 0:1.0.5-2.el6
libgsf.i686 0:1.14.15-5.el6
libidn-devel.i686 0:1.18-2.el6
libjpeg-turbo-devel.i686 0:1.2.1-1.el6
librsvg2.i686 0:2.26.0-5.el6_1.1.0.1.centos
libselinux-devel.i686 0:2.0.94-5.3.el6
libsepol-devel.i686 0:2.0.41-4.el6
libtiff-devel.i686 0:3.9.4-9.el6_3
libtool-ltdl.i686 0:2.2.6-15.5.el6
libwmf-lite.i686 0:0.2.8.4-22.el6.centos
libxcb-devel.i686 0:1.8.1-1.el6
libyaml.i686 0:0.1.3-1.el6
ncurses-devel.i686 0:5.7-3.20090208.el6
sgml-common.noarch 0:0.6.3-32.el6
urw-fonts.noarch 0:2.4-10.el6
xorg-x11-font-utils.i686 1:7.2-11.el6
xorg-x11-proto-devel.noarch 0:7.6-25.el6


●Apacheのインストール

ソースからインストールしています。
詳しくはこちらのインストールを参考にして頂ければと思います。

/usr/local/apacheにインストール、UserDirを公開
 

●PostgreSQLのインストール

ソースからインストールしています。
詳しくはこちらのインストールを参考にして頂ければと思います。
/usr/local/pgsqlにインストール、dataはpgsqlの直下
またPL/pgsqlが必要ですが9.0以降はデフォルトでインストールされます。
  
--------------------------------------------------------
DB名:redmine、ユーザ:redmine、パスワード:redmineを作成しておきます。
作業はpostgresユーザで行います。

# su - postgres
$ createuser -d -P redmine
Enter password for new role:パスワード
Enter in again:パスワード(確認)
 
$ createdb redmine --owner=redmine --encoding=UTF8 --template=template0
--------------------------------------------------------
DB作成が終わったらrootに戻りましょう。
$ exit
 

●Ruby 1.9.3のインストール

# cd /usr/local/src
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
# tar zxvf ./ruby-1.9.3-p392.tar.gz
# cd ./ruby-1.9.3-p392
# ./configure
# make
# make install
# ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [i686-linux]

●Rubygems(Rubyに同梱されています)

# gem -v
1.8.23

●bundlerのインストール

# gem install bundler --no-rdoc --no-ri

Fetching: bundler-1.3.4.gem (100%)
Successfully installed bundler-1.3.4
1 gem installed

--no-rdoc --no-riはドキュメントの不要


●Redmineのインストール


公開ディレクトリ
# useradd redmine ※ユーザを作成するとpublic_htmlが自動的に作成されるようしている
# chmod 755 /home/redmine
# chmod 775 /home/redmine/public_html
 
# cd /usr/local/src
# wget http://rubyforge.org/frs/download.php/76867/redmine-2.3.0.tar.gz
http://rubyforge.org/frs/?group_id=1850で確認してください。

# tar zxvf redmine-2.3.0.tar.gz 
# mv ./redmine-2.3.0/* /home/redmine/public_html/
 
DBへの接続設定
# cp /home/redmine/public_html/config/database.yml.example /home/redmine/public_html/config/database.yml
 
# vi /home/redmine/public_html/config/database.yml
コメント
#production:
#  adapter: mysql
#  database: redmine
#  host: localhost
#  username: root
#  password:
#  encoding: utf8
追記
production:
  adapter: postgresql
  database: redmine #DB名
  host: localhost #接続先
  username: redmine #DBユーザ
  password: "redmine" #ユーザパスワード
 
Mailの設定
# cp /home/redmine/public_html/config/configuration.yml.example /home/redmine/public_html/config/configuration.yml
 
# vi /home/redmine/public_html/config/configuration.yml
 
ここではlocalhost上のSMTPサーバを利用した例です。
詳しくはRedmine.JP様のページを参考にして頂くとわかりやすいと思います。
 
下の方にproduction:だけが記述されている部分があるのでそこへ追記します。(わかりずらい)

# specific configuration options for production environment
# that overrides the default ones

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      domain: redmine.example.com

ちなみに自社では自前のメールサーバがありLAN上から参照できます。なのでこんな感じです。
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "10.1.1.190"
      port: 25
      domain: 自社ドメイン

●Gem pgのインストール

PostgreSQLはソースからインストールしたのでパスを読み込んでから実行する必要がある。

# export PATH=$PATH:/usr/local/pgsql/bin
# gem install pg -- --with-pg-dir=/usr/local/pgsql/ --with-pg-lib=/usr/local/pgsql/lib/ --with-pg-include=/usr/local/pgsql/include/ --no-rdoc --no-ri

Fetching: pg-0.15.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed pg-0.15.0
1 gem installed
Installing ri documentation for pg-0.15.0...
Installing RDoc documentation for pg-0.15.0...


●その他Gemパッケージのインストール

Redmineで必要なパッケージを一括でインストールします。(Gemfileに記載されている

2.3よりDBアダプタはdatabase.ymlを参照して適切なアダプタがインストールされるようである。従ってdatabase.ymlには使用しないアダプター名は指定しないようにしておきます。

database.yml.sampleにはproduction:以外の記述があるため注意です。production以外はコメントにするのがいいでしょう。

# cd /home/redmine/public_html/
# bundle install --without development test

Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.0.4) 
Using i18n (0.6.1) 
Using multi_json (1.7.2) 
Using activesupport (3.2.13) 
Using builder (3.0.0) 
Using activemodel (3.2.13) 
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.1) 
Using tilt (1.3.6) 
Using sprockets (2.2.2) 
Using actionpack (3.2.13) 
Using mime-types (1.21) 
Using polyglot (0.3.3) 
Using treetop (1.4.12) 
Using mail (2.5.3) 
Using actionmailer (3.2.13) 
Using arel (3.0.2) 
Using tzinfo (0.3.37) 
Using activerecord (3.2.13) 
Using activeresource (3.2.13) 
Using bundler (1.3.4) 
Using coderay (1.0.9) 
Using rack-ssl (1.3.3) 
Using json (1.7.7) 
Using rdoc (3.12.2) 
Using thor (0.18.0) 
Using railties (3.2.13) 
Using jquery-rails (2.0.3) 
Using net-ldap (0.3.1) 
Using pg (0.15.0) 
Using ruby-openid (2.1.8) 
Using rack-openid (1.3.1) 
Using rails (3.2.13) 
Using rmagick (2.13.2) 
Your bundle is complete!
Gems in the groups development and test were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.


●初期設定およびテーブル作成

# cd /home/redmine/public_html/

# bundle exec rake generate_secret_token
# RAILS_ENV=production bundle exec rake db:migrate

●Passengerのインストール


# gem install passenger --no-rdoc --no-ri

Fetching: fastthread-1.0.7.gem (100%)
Building native extensions.  This could take a while...
Fetching: daemon_controller-1.1.2.gem (100%)
Fetching: passenger-3.0.19.gem (100%)
Successfully installed fastthread-1.0.7
Successfully installed daemon_controller-1.1.2
Successfully installed passenger-3.0.19
3 gems installed


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

Apacheはソースからインストールしたのでapxs2、path環境変数を設定する必要がある

# export APXS2=/usr/local/apache/bin/apxs
# export PATH=/usr/local/apache/bin:$PATH

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

 
Enterを押します。


--------------------------------------------

Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * Curl development headers with SSL support... found
 * OpenSSL development headers... found
 * Zlib development headers... found
 * 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/local/apache/bin/httpd
 * Apache 2 development headers... found at /usr/local/apache/bin/apxs
 * Apache Portable Runtime (APR) development headers... found at /usr/local/apache/bin/apr-1-config
 * Apache Portable Runtime Utility (APU) development headers... found at /usr/local/apache/bin/apu-1-config

--------------------------------------------

Compiling and installing Apache 2 module...




途中でnot foundが出たら解決して再度実行




--------------------------------------------
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.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.19
   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.

Enterを押します。



--------------------------------------------
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:

   
      ServerName www.yourhost.com
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /somewhere/public    
     
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
     
   

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


●Apache用設定ファイルの新規作成

設定ファイルの書き出し
# passenger-install-apache2-module --snippet > /usr/local/apache/conf/extra/passnger.conf
 
HTTPヘッダ削除、Passengerチューニングをpassnger.confへ(任意)
# vi /usr/local/apache/conf/extra/passnger.conf

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.19
PassengerRuby /usr/local/bin/ruby


追記
# Passengerが追加するHTTPヘッダを削除
Header always unset "X-Powered-By"
Header always unset "X-Rack-Cache"
Header always unset "X-Content-Digest"
Header always unset "X-Runtime"

必要に応じて追記
# Passengerのチューニング設定

※詳しくはhttp://www.modrails.com/documentation/Users%20guide%20Apache.html

 
編集が終わったらhttpd.confでpassnger.confをIncludeさせるようにします。
# vi /usr/local/apache/conf/httpd.conf
最後にでも追記
Include conf/extra/passnger.conf
 
ついでにDocumentRootをRedmineとする(http://IPアドレスで閲覧できる)
DocumentRoot "/home" → "/home/redmine/public_html/public"
 
Apacheのユーザが書き込みできるように設定してApacheを再起動
# chown -R daemon:daemon /home/redmine
# /usr/local/apache/bin/apachectl restart
 
これでIPアドレスによる接続はできると思いますので、初期設定のadmin(パスワード:admin)でログインしてみましょう。
※アクセスできない場合・・・ディレクトリパーミッション、selinuxOFF、iptablesで80ポート開放等をチェックしてみましょう。



ログイン後、上記メニューの「管理」をクリックするとロール、トラッカー、チケットのステータス、ワークフローが設定されていないのでデフォルト設定をロードするよう勧められますのでJapaese(日本語)を選択してデフォルト設定をロードします。




●ログレベル・ログローテーション

# cp /home/redmine/public_html/config/additional_environment.rb.example /home/redmine/public_html/config/additional_environment.rb

ログレベル# vi /home/redmine/public_html/config/additional_environment.rb
config.log_level = :warn

ログファイルのローテーション
1週間ごとにファイルを切り替え12世代(約3ヶ月)履歴を残すようにしています。

# vi /etc/logrotate.d/redmine

/home/redmine/public_html/log/*.log {
  rotate 12
  weekly
  missingok
  notifempty
  copytruncate

  postrotate
      /bin/kill -USR1 `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
  endscript

}

 
Apache再起動
# /usr/local/apache/bin/apachectl restart
 

●EPELレポジトリの調整

標準レポジトリのパッケージがEPELレポジトリのパッケージで上書きされないよう基本的に無効化
 
# vi /etc/yum.repos.d/epel.repo
enabled=1のところを=0に変更
 
※yum-plugin-prioritiesをインストールしてEPELレポジトリのプライオリティを下げておくのもよい(以前RPMforgeリポジトリ導入で書いたので参考にして頂ければと思います)


●テーマを追加

Redmine.JP様で公開されている日本語環境でRedmineの画面を見やすくすることを目的としたテーマ「farend fancy」(farend basicの派生テーマ)を使えるようにします。

# cd /home/redmine/public_html

# git clone git://github.com/farend/redmine_theme_farend_fancy.git public/themes/farend_fancy

Redmineの管理画面から「管理」>「設定」>「表示」→テーマを Farend fancyに変更します。保存ボタンを押すのを忘れずに!
 
 
<参考サイト>
本家Redmine:http://www.redmine.org/projects/redmine/wiki/RedmineInstall
Redmine.JP:http://blog.redmine.jp/articles/2_3/installation_centos/

2012年9月18日火曜日

Redmine2.1インストールしてみた

先日リリースされたRedmine2.1新規インストールしてみた。ついでにDBも先日リリースされたPostgreSQL9.2です。尚、OSはCentOS6.3(x86)です。

以前CentOS6にRedmine2.0+PostgreSQL9.1を構築した手順と全く同じ要領で問題ありませんでした。

こちらを参考にして頂けると幸いです。
http://stdman.blogspot.jp/2012/05/centos6redmine20.html

PostgreSQL9.2ではcreateuserの仕様が若干変わったようで、オプションでロールを割り当てるようです。

ちなみにredmine用ユーザ作成時に、-dでDB作成可、-Pでパスワード作成


$ createuser redmine -d -P
Enter password for new role: ********
Enter it again: ********

オプションはこんな感じです。

$ createuser --help
createuser creates a new PostgreSQL role.

Usage:
  createuser [OPTION]... [ROLENAME]

Options:
  -c, --connection-limit=N  connection limit for role (default: no limit)
  -d, --createdb            role can create new databases
  -D, --no-createdb         role cannot create databases (default)
  -e, --echo                show the commands being sent to the server
  -E, --encrypted           encrypt stored password
  -i, --inherit             role inherits privileges of roles it is a
                            member of (default)
  -I, --no-inherit          role does not inherit privileges
  -l, --login               role can login (default)
  -L, --no-login            role cannot login
  -N, --unencrypted         do not encrypt stored password
  -P, --pwprompt            assign a password to new role
  -r, --createrole          role can create new roles
  -R, --no-createrole       role cannot create roles (default)
  -s, --superuser           role will be superuser
  -S, --no-superuser        role will not be superuser (default)
  -V, --version             output version information, then exit
  --interactive             prompt for missing role name and attributes rather
                            than using defaults
  --replication             role can initiate replication
  --no-replication          role cannot initiate replication
  -?, --help                show this help, then exit

Connection options:
  -h, --host=HOSTNAME       database server host or socket directory
  -p, --port=PORT           database server port
  -U, --username=USERNAME   user name to connect as (not the one to create)
  -w, --no-password         never prompt for password
  -W, --password            force password prompt
 
 
Redmine 2.1よりチケットやWikiに添付ファイルのサムネイル画像が表示できるようになった。
Redmine_ROOT/tmp/thumbails 書込み権限が必要ですので注意
 

2012年8月31日金曜日

Redmine 2.0 でチケット情報をCSVインポート

チケットをCSVからまとめて登録するにはredmine_importerというプラグインをよく使うが、ググってもRedmine 1.x対応ばかり・・・・ですが見つけました!Redmine2.0対応

提供者のksauzzさん?ありがとうございます。
有難く使わさせて頂きます。

とりあえずそのプラグインをインストールしてみました(自己責任です)。
※/RedmineROOT/pluginsのパーミッションに注意

●プラグインファイルの取得
ソースはGithubで公開されています。

ブラウザで以下のアドレスへアクセスするとダウンロードできます。
https://github.com/ksauzz/redmine_importer/tarball/redmine2.x

ダウンロードファイル(2012/08/31現在)
ksauzz-redmine_importer-36d5af5.tar.gz

解凍してフォルダ名をredmine_importerにリネーム

●アップロード
redmine_importerフォルダごと/RedmineROOT/pluginsへ

●fastercsvのインストール
fastercsv 1.4~1.5.3までは動作テストされているらしいので、とりあえず1.5.3を指定

# gem install fastercsv -v=1.5.3
Fetching: fastercsv-1.5.3.gem (100%)
Successfully installed fastercsv-1.5.3
1 gem installed
Installing ri documentation for fastercsv-1.5.3...
Installing RDoc documentation for fastercsv-1.5.3...


●マイグレーションの実行
redmine2.xでは若干違うので注意(詳しくはこちら

# cd /RedmineROOT/
# rake redmine:plugins:migrate RAILS_ENV=production
Migrating redmine_importer (Issue Importer)...
==  CreateImportInProgresses: migrating =======================================
-- create_table(:import_in_progresses)
NOTICE:  CREATE TABLE will create implicit sequence "import_in_progresses_id_seq" for serial column "import_in_progresses.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "import_in_progresses_pkey" for table "import_in_progresses"
   -> 0.0284s
==  CreateImportInProgresses: migrated (0.0284s) ==============================

ちなみにプラグインのアンインストール方法
# rake redmine:plugins:migrate NAME=redmine_importer VERSION=0 RAILS_ENV=production
Migrating redmine_importer (Issue Importer)...
==  CreateImportInProgresses: reverting =======================================
-- drop_table(:import_in_progresses)
   -> 0.0841s
==  CreateImportInProgresses: reverted (0.0841s) ==============================
プラグインディレクトリを削除すればアンインストール完了


あとはRedmineを再起動(Webサーバ)

●使い方
プロジェクト>設定>モジュール>Importer チェックONで使用することができる。
またプロジェクト作成時デフォルトで有効にするためには、管理>設定>プロジェクトでImporter にチェックを入れておく





テスト用のCSVファイルが含まれているので試してみたところCSVをアップロードして読み込みは成功したが、確認ボタンでいざ取り込もうとすると結果表示でエラーになってしまう。
少し研究してみよう。

成功した方がいらっしゃいましたら情報お待ちしております。

-----

早速、情報を頂きました!コメントに記載されている通りソースの一部を書き換えることでインポートが成功します。katanaさんありがとうございます。

# cd /RedmineROOT/
# vi ./plugins/redmine_importer/app/controllers/importer_controller.rb
250行目付近
fixed_version_name = row[attrs_map["fixed_version"]]

fixed_version_name = row[attrs_map["fixed_version"]] || ""


# rake redmine:plugins:migrate RAILS_ENV=production
Migrating redmine_importer (Issue Importer)...


Redmine再起動




 
 

2012年6月8日金曜日

Redmine2.0.1から2.0.2へアップデート

Ruby on Railsの脆弱性が見つかったようでRedmine2.0.2がリリース

Redmine2.0.1を構築したばかりなのに・・・構築はこちらです
でもまだ運用至っていないので、アップデートしちゃいます。
尚、プラグインや外部テーマは一切使用していない状態です。

環境を簡単に説明すると
CentOS6.2(x86)
Apache 2.2.22+Passenger
PostgreSQL9.1.3
※Apache, PostgreSQLはソースからインストール

http://www.redmine.org/projects/redmine/wiki/RedmineUpgradeを参考にアップデート


●Redmine2.0.1のバックアップ

Redmineソース
# mv /home/redmine/public_html /home/redmine/public_html_2.0.1

データベース(PostgreSQL9.1)
データベース名:redmine
ユーザー名:redmine
# /usr/local/pgsql/bin/pg_dump -U redmine -Fc redmine > /home/redmine/public_html_2.0.1/v201_db_`date +%Y%m%d`.dump

v201_db_今日の日付(db_20120608.dump)というスタイルでバックアップファイルが作成されます。


●Redmine2.0.2の配置

ディレクトリの作成
# mkdir /home/redmine/public_html
# chmod 775 /home/redmine/public_html

RedmineはTarボールを利用
ダウンロード先はhttp://rubyforge.org/frs/?group_id=1850を参照
# cd /usr/local/src
# wget http://rubyforge.org/frs/download.php/76189/redmine-2.0.2.tar.gz
# tar zxvf redmine-2.0.2.tar.gz
# mv ./redmine-2.0.2/* /home/redmine/public_html/

設定ファイル等のコピー(プラグインは考慮していない)
# cp /home/redmine/public_html_2.0.1/config/database.yml /home/redmine/public_html/config/

# cp /home/redmine/public_html_2.0.1/config/configuration.yml /home/redmine/public_html/config/

ログ制御
# cp /home/redmine/public_html_2.0.1/config/additional_environment.rb /home/redmine/public_html/config/

添付ファイル # cp /home/redmine/public_html_2.0.1/files/* /home/redmine/public_html/files/

追加したテーマ
# cp -R /home/redmine/public_html_2.2.0/public/themes/farend_fancy /home/redmine/public_html/public/themes/

passengerで稼働しているためApacheユーザーに権限を与える
# chown -R daemon:daemon /home/redmine/public_html

Gemパッケージ(Railsが3.2.5になります)
# cd /home/redmine/public_html
# bundle install --without development test mysql sqlite →DBがPostgreSQLの場合
# bundle install --without development test postgresql sqlite →DBがMySQLの場合
Using rake (0.9.2.2) 
Using i18n (0.6.0) 
Using multi_json (1.3.6) 
Installing activesupport (3.2.5) 
Using builder (3.0.0) 
Installing activemodel (3.2.5) 
Using erubis (2.7.0) 
Using journey (1.0.3) 
Using rack (1.4.1) 
Using rack-cache (1.2) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.3) 
Installing actionpack (3.2.5) 
Using mime-types (1.18) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.4.4) 
Installing actionmailer (3.2.5) 
Using arel (3.0.2) 
Using tzinfo (0.3.33) 
Installing activerecord (3.2.5) 
Installing activeresource (3.2.5) 
Using bundler (1.1.4) 
Using coderay (1.0.6) 
Using json (1.7.3) 
Using net-ldap (0.3.1) 
Using pg (0.13.2) 
Using rack-ssl (1.3.2) 
Using rdoc (3.12) 
Installing thor (0.15.2) 
Installing railties (3.2.5) 
Installing rails (3.2.5) 
Using prototype-rails (3.2.1) 
Using ruby-openid (2.1.8) 
Using rack-openid (1.3.1) 
Using rmagick (2.13.1) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

# rake generate_secret_token
# rake db:migrate RAILS_ENV=production 
# rake redmine:plugins:migrate RAILS_ENV=production
# rake tmp:cache:clear
# rake tmp:sessions:clear


passengerで稼働しているためApacheユーザーに権限を与える
# chown -R daemon:daemon /home/redmine/public_html


Apacheの再起動

Redmine 2.0.2 + PostgreSQL

以上で完了

※2.1系、2.2系でも同じ手順で大丈夫と思われます。

<PostgreSQL 参考>
ちなみにバックアップしたデータベースの復元方法です。


データベース名:redmine
ユーザー名:user1
バックアップ名:v202_dbbackup.dump


1.空のデータベースを作成

原則としてrootでは作業できませんので、PostgreSQLを運用しているユーザで行います。(私はpostgresというユーザで運用しています)

# su - postgres

$ createdb redmine --owner=user1 --encoding=UTF8 --template=template0


2.復元

[postgres@localhost]$ pg_restore -d redmine ./v202_dbbackup.dump

これでOKです。
 



Google検索