CentOS6にRedmineのインストールする手順の補足

Redmine 1.4をCentOS 6にインストールする手順 | Redmine.JP Blog

こちらを見ながら作業しましたが、毎回毎回ハマるんですよ…
足りない情報、エラーがあったときの対処が書いてないので補足しておきます

rubygemのインストール

~~~
wget http://rubyforge.org/frs/download.php/76032/rubygems-1.8.23.tgz
tar xvzf rubygems-1.8.23.tgz
cd rubygems-1.8.23/
sudo ruby setup.rb
~~~

失敗したときのログ
~~~
$ sudo gem install bundler –no-rdoc –no-ri

sudo: gem: command not found
~~~

bundle install –without development test postgresql sqliteでのエラーが出る

ruby-develをインストール

~~~

~~~
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h

Gem files will remain installed in /home/kimoto/.bundler/tmp/15583/gems/mysql-2.8.1 for inspection.
Results logged to /home/kimoto/.bundler/tmp/15583/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
An error occured while installing mysql (2.8.1), and Bundler cannot continue.
Make sure that `gem install mysql -v ‘2.8.1’` succeeds before bundling.
~~~

mysql-develのインストール

~~~
sudo yum install mysql-devel
~~~

失敗したときのログ

~~~
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h

Gem files will remain installed in /home/kimoto/.bundler/tmp/15583/gems/mysql-2.8.1 for inspection.
Results logged to /home/kimoto/.bundler/tmp/15583/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
An error occured while installing mysql (2.8.1), and Bundler cannot continue.
Make sure that `gem install mysql -v ‘2.8.1’` succeeds before bundling.
~~~

ImageMagickのインストール

~~~
sudo yum install ImageMagick ImageMagick-devel
~~~

失敗したときのログ
~~~
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5… yes
checking for gcc… yes
checking for Magick-config… no
Can’t install RMagick 2.13.1. Can’t find Magick-config in /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/kimoto/bin:/sbin:/usr/sbin:/usr/local/sbin

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

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/bin/ruby

Gem files will remain installed in /home/kimoto/.bundler/tmp/15627/gems/rmagick-2.13.1 for inspection.
Results logged to /home/kimoto/.bundler/tmp/15627/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occured while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v ‘2.13.1’` succeeds before bundling.
~~~

rakeに失敗する

mysqlのユーザーにホストネームをつけます
~~~
# mysql -uroot -p
mysql> create database db_redmine default character set utf8;
mysql> grant all on db_redmine.* to [email protected]’127.0.0.1′ identified by ‘********’;
mysql> flush privileges;
mysql> exit;
~~~

失敗したときのログ
~~~
$ sudo rake db:migrate RAILS_ENV=production
Please install RDoc 2.4.2+ to generate documentation.
rake aborted!
Access denied for user ‘user_redmine’@’localhost’ (using password: YES)

Tasks: TOP => db:migrate => environment
(See full trace by running task with –trace)
~~~

これでよーやく動きました (/>Д<)/~┻┻ yumでうまく入るようにならんもんですかねぇ…