ApacheのVirtualHostでRedmineをインストール

Table of Contents

参考にしたページ http://blog.redmine.jp/articles/3_2/install/centos/ http://qiita.com/ironsand/items/8617ba82767884528246 http://twinbird-htn.hatenablog.com/entry/2016/02/26/203314 http://qiita.com/lapisfox/items/680e49fe1478c58bf083 http://www.sakagami3.com/entry/20110809/1312865754 http://www.redmine.org/ http://redmine.jp/guide/RedmineInstall/ http://park1.wakwak.com/~ima/centos_redmine0001.html http://naonao.wktk.so/?p=2874

開発ツール(Cコンパイラ等)のインストール

yum -y groupinstall "Development Tools"

RubyとPassengerのビルドに必要なヘッダファイルなどのインストール

yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel ruby-devel

PostgreSQLとヘッダファイルのインストール

yum -y install postgresql-server postgresql-devel

Apacheとヘッダファイルのインストール

yum -y install postgresql-server postgresql-devel

ImageMagickとヘッダファイル・日本語フォントのインストール

yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts

Rubyのインストール

mkdir work && cd work
curl -O https://cache.ruby-lang.org/pub/ruby/<バージョン1>/ruby-<バージョン2>.tar.gz
tar xvf ruby-<バージョン>.tar.gz
cd ruby-<バージョン>
./configure --disable-install-doc
make
make install
ruby -v
cd ..
cd ..
rm -rf work 

Ruby用のパッケージ管理ツールであるbundlerをインストール Redmineが使用するgemパッケージをインストールするのに使用

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

PostgreSQLの設定 データベースクラスタの新規作成

postgresql-setup initdb
vim /var/lib/pgsql/data/pg_hba.conf
.
.
.
# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records.  In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.
host    redmine         redmine         127.0.0.1/32            md5
host    redmine         redmine         ::1/128                 md5
.
.
.
systemctl start postgresql.service
systemctl enable postgresql

Redmine用ユーザーの作成

cd /var/lib/pgsql
sudo -u postgres createuser -P redmine

Redmine用データベースの作成

sudo -u postgres createdb -E UTF-8 -l ja_JP.UTF-8 -O redmine -T template0 redmine

Redmineのインストール

cd <Redmineのインストールディレクトリ>
curl -O http://www.redmine.org/releases/redmine-<バージョン>.tar.gz
tar xzvf redmine-<バージョン>.tar.gz

Redmineのインストールディレクトリ/config/にdatabase.yml を作成

production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: <PostgreSQL上に作成したredmine用ユーザーのパスワード>
  encoding: utf8

Redmineからメールサーバへ接続するための設定や日本語フォントファイルのパスを記述した設定ファイルを作成 Redmineのインストールディレクトリ/config/にconfiguration.yml ファイルを作成 ※インデントに注意

production:
  email_delivery:
  delivery_method: :smtp
  smtp_settings:
  address: <ホスト名>
  port: 25
  domain: <ドメイン名>

  rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
cd v

yum -y install libxml2-devel yum -y install libxslt-devel

Rubyのパッケージ管理ツール「bundler」を使用してRedmineが依存するgemパッケージをインストール

bundle install --without development test --path vendor/bundle

データベースのテーブル作成

RAILS_ENV=production bundle exec rake db:migrate

デフォルトデータの登録

RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data

Apache上でRedmineなどのRailsアプリケーションの実行するために使われるPhusion Passengerをインストール

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

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

passenger-install-apache2-module

Apache用設定内容の確認

passenger-install-apache2-module --snippet
chown -R apache:apache <Redmineのインストールディレクトリ>

DNSへの登録忘れずに!