Redmineちゃん

ハピハピハッピー
という訳でRedmineを今回のプロジェクトで使おうと思ったのでインストールしてみました。

べっ別にTracが嫌いな訳じゃないんだからね。
ただRedmineを使った事無かったから使ってみたかっただけなんだからね。


サーバ環境はCentOS5.4で、
RedmineMySQLPostgreSQLsqliteを必要としますが、
既にMySQLがインストールされている事とします。
MySQLは5.1.40を使います。


・今回導入する環境
CentOS5.4
Ruby1.8.5
MySQL5.1.40
Subversion

MySQLSubversionは既にインストール済みとします。すみません。


以下はインストール手順です。

RedmineのサイトよりRedmine本体をダウンロード
http://rubyforge.org/frs/?group_id=1850
redmine-0.8.7.zipをダウンロードします。
(インストール時点では0.8.7が最新です。)

  • rubyをインストール

Redmine0.8.7ではrubyのバージョンが1.8.7以上が必要です。

サーバにrubyがインストールされてなければインストールしましょう。
CentOSは特に何にも設定していないため、
yumコマンドだと古いrubyがインストールされてしまいます。
なので、今回はパッケージをダウンロードしてきてインストールします。

もしインストールされていたら消しちゃいましょう。

# yum remove ruby


rubyRPM化にしたいので、先ずはその準備という訳でRPMforgeをインストール。
RPMforgeとは標準リポジトリで提供されないパッケージをyumでインストールできるためのものらしい。何のこっちゃ。

・キーを追加
# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
・パッケージをダウンロード
# wget http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
・署名が正しいか-Kオプションで確認
# rpm -K rpmforge-release-0.3.6-1.el5.rf.i386.rpm
・インストール
# rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpmyumリポジトリにrpmforgeをenambe=0として編集
# sed -ie 's/enabled = [01]/enabled = 0/' /etc/yum.repos.d/rpmforge.repo

普段はrpmforgeを無効にしてます。
有効にするときは yum のオプションにrpmforgeを指定すればOK。

次に、checkinstallというtarballからRPMを作成してくれるパッケージもインストールしましょう。

checkinstallをインストール
yum --enablerepo=rpmforge install checkinstall

以上で準備ができたら、
rubyのインストールということで1.8.7をどこのディレクトリでも良いのでダウンロード後に解凍してコンパイルを実行。
configure指定時はreadline(どんなモジュールかは自分で調べてね)が必要なので、指定を忘れずに。

# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz
# tar -xvf ruby-1.8.7-p174.tar.gz
# cd ruby-1.8.7-p174
# ./configure --prefix=/usr/local --with-install-readline

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

あれエラーだと思ったら開発環境をインストールしてなかったorz
というわけで必要となる開発環境を調べてきてyumでインストール

yum install gcc
yum install zlib-devel
yum install rpm-build
yum install openssl-devel
yum install readline-devel
yum install nkf


再度configureから実行

# ./configure --prefix=/usr/local --with-install-readline
# make

警告がいっぱい出たけどmakeまで終わったから気にせず、
次にcheckinstallでパッケージ化を行う。

# checkinstall --fstrans=no

checkinstall 1.6.0, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.


The package documentation directory ./doc-pak does not exist. 
Should I create a default set of package docs?  [y]: y

Preparing package documentation...OK

Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]? R


Please write a description for the package.
End your description with an empty line or EOF.
>> ruby
>> 

 **************************************
 **** RPM package creation selected ***
 **************************************

This package will be built according to these values: 

1 -  Summary: [ ruby ]
2 -  Name:    [ ruby-1.8.7 ]
3 -  Version: [ p174 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ ruby-1.8.7-p174 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ ruby-1.8.7 ]

Enter a number to change any of them or press ENTER to continue: 

Installing with make install...

========================= Installation results ===========================
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./instruby.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc"
installing binary commands
installing command scripts
installing library scripts
installing headers
installing manpages
installing extension objects
installing extension scripts

======================== Installation successful ==========================

Copying documentation directory...
./
./README
./COPYING.ja
./README.ja
./doc/
./doc/irb/
./doc/irb/irb.rd.ja
./doc/irb/irb-tools.rd.ja
./doc/irb/irb.rd
./doc/forwardable.rd
./doc/forwardable.rd.ja
./doc/NEWS-1.8.0
./doc/shell.rd.ja
./doc/shell.rd
./doc/ChangeLog-1.8.0
./COPYING
./README.EXT
./README.EXT.ja
./ChangeLog
./NEWS
./GPL

Some of the files created by the installation are inside the build
directory: /tmp/ruby-1.8.7-p174

You probably don't want them to be included in the package,
especially if they are inside your home directory.
Do you want me to list them?  [n]: n
Should I exclude them from the package? (Saying yes is a good idea)  [y]: y

Copying files to the temporary directory...OK

Striping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

Building RPM package...OK

NOTE: The package will not be installed

Erasing temporary files...OK

Deleting doc-pak directory...OK

Writing backup package...OK

Deleting temp dir...OK


 **********************************************************************

 Done. The new package has been saved to

 /usr/src/redhat/RPMS/i386/ruby-1.8.7-p174-1.i386.rpm
 You can install it in your system anytime using: 

      rpm -i ruby-1.8.7-p174-1.i386.rpm

 **********************************************************************

終わったということで、
# ruby -v
と実行すると無事に
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
が表示され、ruby-1.8.7のインストールが完了。

ただ、このままではRPM化されていないので、
いったん削除後に再度インストール。

rubyを探す
# find / -name ruby
/tmp/ruby-1.8.7-p174/ruby
/tmp/ruby-1.8.7-p174/test/ruby
/usr/local/lib/ruby
/usr/local/bin/ruby


対象のrubyを削除
# rm -rf /usr/local/lib/ruby
# rm -rf /usr/local/bin/ruby

さっきRPMにしたrubyをインストール
# rpm -ivh /usr/src/redhat/RPMS/i386/ruby-1.8.7-p174-1.i386.rpm
# ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]

無事にrubyのインストールが完了。


  • Rubyのパッケージ管理システムであるrubygemsをインストール

rubygemsはCentOS5.4だとyumではインストールできません。
そのため、これも同じくパッケージをダウンロードしてきてインストールします。
rubygems(Rubyのパッケージ管理システム)をインストール

# wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
# tar -xvf rubygems-1.3.5.tgz 
# cd rubygems-1.3.5
# checkinstall -R "ruby setup.rb"

checkinstall 1.6.0, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.


The package documentation directory ./doc-pak does not exist. 
Should I create a default set of package docs?  [y]: y

Preparing package documentation...OK

Please write a description for the package.
End your description with an empty line or EOF.
>> 

 **************************************
 **** RPM package creation selected ***
 **************************************

This package will be built according to these values: 

1 -  Summary: [ Package created with checkinstall 1.6.0 ]
2 -  Name:    [ rubygems ]
3 -  Version: [ 1.3.5 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ rubygems-1.3.5 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ rubygems ]

Enter a number to change any of them or press ENTER to continue: 

Installing with ruby setup.rb...

========================= Installation results ===========================
RubyGems 1.3.5 installed

=== 1.3.5 / 2009-07-21

Bug fixes:

 * Fix use of prerelease gems.
 * Gem.bin_path no longer escapes path with spaces. Bug #25935 and #26458.

Deprecation Notices:

 * Bulk index update is no longer supported (the code currently remains, but not
  the tests)
 * Gem::manage_gems was removed in 1.3.3.
 * Time::today was removed in 1.3.3.


                                                                                                                                                          • -
RubyGems installed the following executables: /usr/local/bin/gem ======================== Installation successful ========================== Copying documentation directory... ./ ./README ./ChangeLog Copying files to the temporary directory...OK Striping ELF binaries and libraries...OK Compressing man pages...OK Building file list...OK Building RPM package...OK NOTE: The package will not be installed Erasing temporary files...OK Deleting doc-pak directory...OK Deleting temp dir...OK ********************************************************************** Done. The new package has been saved to /usr/src/redhat/RPMS/i386/rubygems-1.3.5-1.i386.rpm You can install it in your system anytime using: rpm -i rubygems-1.3.5-1.i386.rpm ********************************************************************** # rpm -ivh /usr/src/redhat/RPMS/i386/rubygems-1.3.5-1.i386.rpm # gem -v 1.3.5

という訳でrubygemsのインストールは完了。

これは特にバージョンを指定せずにそのままgemコマンドでインストールを行う。

# gem install rails

Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
8 gems installed
Installing ri documentation for rake-0.8.7...
Installing ri documentation for activesupport-2.3.5...
Installing ri documentation for activerecord-2.3.5...
Installing ri documentation for rack-1.0.1...
Installing ri documentation for actionpack-2.3.5...
Installing ri documentation for actionmailer-2.3.5...
Installing ri documentation for activeresource-2.3.5...
Installing ri documentation for rails-2.3.5...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for activesupport-2.3.5...
Installing RDoc documentation for activerecord-2.3.5...
Installing RDoc documentation for rack-1.0.1...
Installing RDoc documentation for actionpack-2.3.5...
Installing RDoc documentation for actionmailer-2.3.5...
Installing RDoc documentation for activeresource-2.3.5...
Installing RDoc documentation for rails-2.3.5...

これでRedmineをインストールする準備は整いました。


今日はここまで。Redmine本体のインストールの続きはまた明日。

という訳で、みんなも作ってアラモード