3
5

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.

CentOS7にRedmineを導入する

Last updated at Posted at 2018-01-27

概要

CentOS7にAnsibleを利用してRedmineをインストールした際の記録です。
なお手順はほぼ以下のサイトを参考に実施し、うまくいかないところだけ修正している。
RedmineをCentOSに自動インストールためのAnsibleプレイブック

AnsibleとGitのインストール

以下のコマンドで、AnsibleとGitをインストールする。

$ sudo yum -y ansible git

Ansibleプレイブックの取得とカスタマイズ

以下のコマンドで、Redmineを自動インストールするAnsibleプレイブックを取得し、カスタマイズのためにフォルダごとコピーしておく。

$ mkdir ~/redmine-centos-ansible
$ cd ~/redmine-centos-ansible
$ git clone https://github.com/farend/redmine-centos-ansible.git
$ cd ../
$ cp -pr redmine-centos-ansible/ redmine-centos-ansible-cunstomize
$ cd redmine-centos-ansible-cunstomize

以下のファイルを修正する。
・group_vars/redmine-servers:データベースのredmineユーザーのパスワードを設定
・roles/system/tasks/main.yml:システム関連の自動インストール設定でfirewallのチェックを無効化

~/redmine-centos-ansible-cunstomize/redmine-centos-ansible/group_vars/redmine-servers
# ----------------------------------------------------------------------
# データベースの redmine ユーザーのパスワード (変更推奨)
### パスワード変更 begin
# db_passwd_redmine: Must_be_changed!
db_passwd_redmine: NewPassword
### パスワード変更 end
# ----------------------------------------------------------------------
(以下、省略)
~/redmine-centos-ansible-cunstomize/redmine-centos-ansible/roles/system/tasks/main.yml
(中略)
### firewallのチェックを無効化(エラーが出るため) begin
# - name: firewalldが起動しているか確認
#  become: yes
#  shell: firewall-cmd --state
#  register: firewall_state
#  ignore_errors: yes
#  changed_when: false
#  check_mode: no
#
# - name: firewalldでHTTPを許可
#  become: yes
#  command: firewall-cmd --zone=public --add-service=http --permanent
#  when: firewall_state.rc == 0
#
# - name: firewalldのポリシーをリロード
#  become: yes
#  command: firewall-cmd --reload
#  when: firewall_state.rc == 0
### firewallのチェックを無効化(エラーが出るため) end
(以下、省略)

Ansibleプレイブックの実行

以下のコマンドで、カスタマイズしたAnsibleプレイブックを実行する。

$ cd ~/redmine-centos-ansible-cunstomize/redmine-centos-ansible
$ sudo ansible-playbook -i hosts site.yml

PLAY [redmine-servers] *************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************
ok: [localhost]

TASK [system : SELinuxの状態確認] *******************************************************************************************
ok: [localhost]

TASK [system : 起動時にSELinux無効化 (/etc/sysconfig/selinux)] ****************************************************************
skipping: [localhost]

TASK [system : SELinux無効化 (setenforce)] ********************************************************************************
skipping: [localhost]

TASK [system : 開発ツールのインストール] *******************************************************************************************
changed: [localhost]

TASK [system : RubyとPassengerのビルドに必要な開発ツールやヘッダファイルのインストール] *************************************************************
changed: [localhost]

TASK [system : PostgreSQLとヘッダファイルのインストール] ******************************************************************************
changed: [localhost]

TASK [system : Apacheとヘッダファイルのインストール] **********************************************************************************
changed: [localhost]

TASK [system : ImageMagickとヘッダファイル・日本語フォントのインストール] *********************************************************************
changed: [localhost]

TASK [system : そのほかのツールのインストール] ****************************************************************************************
ok: [localhost]

TASK [system : 作業ディレクトリ作成] *********************************************************************************************
changed: [localhost]

TASK [pg : PostgreSQL initdb] ******************************************************************************************
changed: [localhost]

TASK [pg : pg_hba.confにredmine用設定が存在するか確認] *****************************************************************************
ok: [localhost]

TASK [pg : pg_hba.conf設定変更用パッチを配置] *************************************************************************************
changed: [localhost]

TASK [pg : pg_hba.confにredmine用設定を追加] **********************************************************************************
changed: [localhost]

TASK [pg : PostgreSQL起動] ***********************************************************************************************
changed: [localhost]

TASK [pg : PostgreSQL ユーザー作成] ******************************************************************************************
changed: [localhost]

TASK [pg : PostgreSQL データベース作成] ****************************************************************************************
changed: [localhost]

TASK [ruby : Rubyがインストールされているか確認] **************************************************************************************
ok: [localhost]

TASK [ruby : Rubyがダウンロード済みか確認] *****************************************************************************************
ok: [localhost]

TASK [ruby : Rubyのソースコードのダウンロード] ***************************************************************************************
changed: [localhost]

TASK [ruby : Rubyのソースコードを展開] *******************************************************************************************
changed: [localhost]

TASK [ruby : Rubyのビルド1 (configure)] ************************************************************************************
changed: [localhost]

TASK [ruby : Rubyのビルド2 (make)] *****************************************************************************************
changed: [localhost]

TASK [ruby : Rubyのインストール] **********************************************************************************************
changed: [localhost]

TASK [ruby : bundlerのインストール] *******************************************************************************************
changed: [localhost]

TASK [redmine : Redmineのソースコードをチェックアウト] ********************************************************************************
changed: [localhost]

TASK [redmine : database.ymlの作成] ***************************************************************************************
changed: [localhost]

TASK [redmine : configuration.ymlの作成] **********************************************************************************
changed: [localhost]

TASK [redmine : Gemfile.lockが存在するか確認] **********************************************************************************
ok: [localhost]

TASK [redmine : gemsパッケージのインストール] **************************************************************************************
changed: [localhost]

TASK [redmine : gemsパッケージのアップデート] **************************************************************************************
skipping: [localhost]

TASK [redmine : secret tokenの作成] ***************************************************************************************
changed: [localhost]

TASK [redmine : データベースのマイグレーション] ***************************************************************************************
changed: [localhost]

TASK [redmine : デフォルトデータ(日本語)をロード] *************************************************************************************
changed: [localhost]

TASK [redmine : farend_basicテーマのダウンロード] ********************************************************************************
changed: [localhost]

TASK [redmine : テーマをfarend_basicに切り替え] *********************************************************************************
changed: [localhost]

TASK [redmine : デフォルトの言語を日本語に変更] ***************************************************************************************
changed: [localhost]

TASK [redmine : ユーザー名の表示形式を「姓 名」に変更] ***********************************************************************************
changed: [localhost]

TASK [redmine : 添付ファイルとリポジトリのエンコーディングを設定] ******************************************************************************
changed: [localhost]

TASK [redmine : 添付ファイルのサムネイルを表示] ***************************************************************************************
changed: [localhost]

TASK [apache : Redmineディレクトリ以下のオーナーを変更] ********************************************************************************
changed: [localhost]

TASK [apache : Passengerがインストールされているか確認] *******************************************************************************
ok: [localhost]

TASK [apache : Passengerをインストール] ***************************************************************************************
changed: [localhost]

TASK [apache : PassengerのApache用モジュールのインストール] **************************************************************************
changed: [localhost]

TASK [apache : PassengerのApache用モジュールの設定を取得] ***************************************************************************
ok: [localhost]

TASK [apache : redmine.confの作成] ****************************************************************************************
changed: [localhost]

TASK [apache : httpdの再起動] **********************************************************************************************
changed: [localhost]

TASK [完了] **************************************************************************************************************
ok: [localhost] => {
    "msg": "インストールが完了しました。 http://192.168.xx.xx/redmine/ にアクセスしてください。"
}

PLAY RECAP *************************************************************************************************************
localhost                  : ok=46   changed=36   unreachable=0    failed=0   

RedmineのPluginの導入

以下のコマンドで、Pluginを導入する。

$ sudo -u apache git clone --depth 1 https://github.com/syagawa/redmine_absolute_datetime
$ sudo -u apache git clone --depth 1 https://github.com/haru/redmine_wiki_extensions
$ sudo -u apache git clone --depth 1 https://github.com/akiko-pusu/redmine_banner
$ sudo -u apache git clone --depth 1 https://github.com/hidakatsuya/redmine_default_custom_query
$ sudo -u apache git clone --depth 1 https://github.com/akiko-pusu/redmine_issue_templates
$ sudo -u apache git clone --depth 1 https://github.com/suer/redmine_issues_summary_graph
$ sudo -u apache git clone --depth 1 https://github.com/Loriowar/redmine_issues_tree
$ sudo -u apache git clone --depth 1 https://github.com/suer/redmine_japanese_help
$ sudo -u apache git clone --depth 1 https://github.com/deecay/redmine_pivot_table
$ sudo -u apache bundle install --jobs=8 --without development test
$ sudo -u apache bundle exec rake redmine:plugins:migrate RAILS_ENV=production
$ sudo -u apache bundle exec rake db:migrate RAILS_ENV=production
$ sudo systemctl restart httpd

以上

3
5
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
3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?