0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Redmine3.2構築 3/3]Redmine3.2をCentOS6.7にインストール

Last updated at Posted at 2018-09-19

概要

CentOS6.7にRedmine環境を構築する

  1. Apache2.2をソースからインストール
  2. MariaDB10.1をソースからインストール
  3. Redmine3.2をインストール(本ページ)

構成

H/S Name Version Memo
OS CentOS 6.7
Web Server Apache 2.2.27 ソースインストール
Database MariaDB 10.1.36 ソースインストール
Application Redmime 3.2.9

参考手順

http://devtech.blog.jp/archives/1855080.html
https://qiita.com/murai-taisuke/items/173b3cbbd697e630047d
https://altarf.net/computer/rails/2467

手順

事前準備

  • gitをインストール
# yum install -y git
  • Githubとのhttps通信のエラーが出るのを回避
# yum update -y nss curl libcurl
  • rbenvをインストール
# git clone https://github.com/rbenv/rbenv.git ~/.rbenv
# echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
# ~/.rbenv/bin/rbenv init
  • ~/.bash_profileの末尾に追記
# echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
  • シェルに入りなおす
  • ruby-buildをインストール
# git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
  • Ruby依存パッケージをインストール
# yum install -y gcc gcc-c++ openssl-devel readline-devel zlib-devel libcurl-devel ImageMagick ImageMagick-devel
  • Rubyをインストール
# rbenv install 2.2.2 -v
# rbenv global 2.2.2
# gem install bundler --no-ri --no-rdoc

Redmineインストール

  • Redmine用のデータベース作成
# mysql -uroot -ppassword
MariaDB [(none)]> CREATE DATABASE redmine DEFAULT CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL ON redmine.* TO redmine@localhost IDENTIFIED BY 'redmine';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit
  • Redmine3.2をダウンロード
# mkdir /root/install
# cd /root/install
# curl -O http://www.redmine.org/releases/redmine-3.2.9.tar.gz
# tar xzvf redmine-3.2.9.tar.gz
# mv redmine-3.2.9 /var/lib/redmine
  • データベース接続設定
# cp -p /var/lib/redmine/config/database.yml.example /var/lib/redmine/config/database.yml
# vi /var/lib/redmine/config/database.yml
/var/lib/redmine/config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine                  # CHANGE
  password: redmine                  # CHANGE
  encoding: utf8
  • メールとImagemagicの設定
# cp -p /var/lib/redmine/config/configuration.yml.example  /var/lib/redmine/config/configuration.yml
# vi /var/lib/redmine/config/configuration.yml
/var/lib/redmine/config/configuration.yml
production:
### ADD ###
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      domain: "example.com"
  rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
### ADD ###
  • gemインストール
# cd /var/lib/redmine/
# bundle install --without development test --path vendor/bundle
# bundle exec gem list
  • Redmineセキュリティートークンの生成、マイグレーションの実行、Redmine初期データの投入
# bundle exec rake generate_secret_token
# RAILS_ENV=production bundle exec rake db:migrate
# RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data
  • Redmine用ユーザの作成
# useradd redmine
# passwd redmine
New password:redmine                                                     # Input & Enter
Retype new password:redmine                                              # Input & Enter
# chown -R redmine:redmine /var/lib/redmine/
  • Passengerのインストール
# gem install passenger --no-rdoc --no-ri
  • ソースインストールしたApacheに合わせて、パスを変更
# export APXS2="/usr/local/apache/bin/apxs"
# export PATH="/usr/local/apache/bin:$PATH"
  • /rootの実行権限を付与
# chmod o+x "/root"
  • PassengerのApache用モジュールをインストール
    • 全てデフォルトのままEnter
    • インストールが無事開始された場合、完了までに10~20分程度かかる
    • *** EXCEPTION: No such file or directory - /usr/local/apache/bin/apxs (Errno::ENOENT)
      というエラーが出た場合は、/usr/local/apache/bin/apxs 1行目のシバンを#!/usr/bin/perl -wに修正後、再度実行
# passenger-install-apache2-module
  • Apacheの設定ファイル末尾に、設定を追加
# vi /usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/httpd.conf
### ADD ###
LoadModule passenger_module /root/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
   PassengerRoot /root/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/passenger-5.3.5
   PassengerDefaultRuby /root/.rbenv/versions/2.2.2/bin/ruby
</IfModule>

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot /var/lib/redmine/public
</VirtualHost>

<Directory "/var/lib/redmine/public">
   Options Indexes FollowSymLinks
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>
### ADD ###
  • Apacheを再起動
# service httpd restart
  • Redmineにアクセスし、ログインできるか確認

おしまい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?