AnsibleでRedmineをCentOSにインストール
2019/03/01時点でインストールできた手順です。
バージョンアップすると動かなくなる可能性があるので注意してください
ソフトウェア | バージョン |
---|---|
OS | CentOS Linux release 7.2.1511 |
Redmine | Redmine v3.4.9 |
データベース | PostgreSQL 9.2.24 |
Webサーバ | Apache 2.4.6 |
Ruby | 2.4.1 |
https://github.com/farend/redmine-centos-ansible
をベースにしたが動かない・・・
仕方がないので試行錯誤しながら実行した
- selinuxを停止する
- ユーザー作成とパーミッション変更
- Ansibleとgitのインストール
- playbookのダウンロード
- パスワード変更
- selinuxの部分を変更する
- playbook実行
- 感想
selinuxを停止する
一時停止だとうまくいかない所があるので
disabledにする
$ cp -piv /etc/selinux/config /etc/selinux/config.`date "+%Y%m%d"` $ vi /etc/selinux/config
下記のように修正する
##SELINUX=enforcing #↓ SELINUX=disabled
再起動する
reboot
再起動後に確認
$ getenforce # DisabledがでればOK
ユーザー作成とパーミッション変更
「owl」に意味はない。適当なユーザー名でもOK
useradd owl
passwd owl
# 適当なパスワードを入力
rootのパスワードを変更
キー接続しかないパターンの場合にわからない場合はやる
passwd
# 適当なパスワードを入力
sudoコマンド設定変更
visudo
98行目あたりのAllowの部分をに追加する
owl ALL=(ALL) ALL
Ansibleとgitのインストール
#先程作ったユーザーに変更する $ su owl $ cd $ sudo yum install -y epel-release $ sudo yum install -y ansible git
playbookのダウンロード
git clone https://github.com/farend/redmine-centos-ansible.git
# /home/owl/redmine-centos-ansibleができる
パスワード変更
vi /home/owl/redmine-centos-ansible/group_vars/redmine-servers # db_passwd_redmine: Must_be_changed! # ↓ db_passwd_redmine: tekitouna_password
selinuxの部分を変更する
vi /home/owl/redmine-centos-ansible/roles/system/tasks/main.yml
#- name: SELinuxの状態確認 # command: # /usr/sbin/selinuxenabled # register: # result # changed_when: false # failed_when: result.rc not in [0, 1] #- name: 起動時にSELinux無効化 (/etc/sysconfig/selinux) # become: yes # selinux: state=disabled # when: result.rc == 0 #- name: SELinux無効化 (setenforce) # become: yes # command: setenforce 0 # when: result.rc == 0
playbook実行
cd /home/owl/redmine-centos-ansible/ sudo ansible-playbook -i hosts site.yml
どんなだけがんばっても、下記のエラーが解消できなかった
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and\ninstalling your bundle as root will break this application for all non-root\nusers on this machine.\nThe dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.\nBundler could not find compatible versions for gem \"bundler\":\n In Gemfile:\n bundler (< 2.0.0, >= 1.5.0)\n\n Current Bundler version:\n bundler (2.0.1)\nThis Gemfile requires a different version of Bundler.\nPerhaps you need to update Bundler by running `gem install bundler`?\n\nCould not find gem 'bundler (< 2.0.0, >= 1.5.0)' in any of the relevant sources:\n the local ruby installation
無理やり通す
rootにもどる
#rootの状態で実行する $ gem uninstall bundler $ gem update --system $ gem install bundler -v1.17.3 $ bundle -v # Bundler version 1.17.3とでる
バージョンをさげたあとにユーザーをもとに戻す
#rootの状態で実行する su owl #owlの状態で実行する $ cd /var/lib/redmine # ファイルを書き込みためにパーミッションを変更する $ sudo chown -R owl:owl /var/lib/redmine $ bundle install $ bundle update
チェックアウトができなくなるのでコメントアウトする
#owlの状態で実行する
vi /home/owl/redmine-centos-ansible/roles/redmine/tasks/main.yml
コメントアウトの箇所
#- name: Redmineのソースコードをチェックアウト # become: yes # subversion: # repo={{ redmine_svn_url }} # dest={{ redmine_dir }}
続きをおこなう
#owlの状態で実行する sudo chown -R root:root /var/lib/redmine cd /home/owl/redmine-centos-ansible sudo ansible-playbook -i hosts site.yml
完了画面が表示される
TASK [apache : httpdの再起動] ********************************************************************************************************************************************** changed: [localhost] TASK [完了] ************************************************************************************************************************************************************** ok: [localhost] => { "msg": "インストールが完了しました。 http://ipアドレス/redmine/ にアクセスしてください。" } PLAY RECAP ************************************************************************************************************************************************************* localhost : ok=33 changed=10 unreachable=0 failed=0
ログイン後の設定は
https://www.kagoya.jp/howto/rentalserver/redmine/
を参考にする
もっと細かい設定は以下の本を参考にする
- 作者: 前田剛
- 出版社/メーカー: 秀和システム
- 発売日: 2016/12/07
- メディア: Kindle版
- この商品を含むブログ (1件) を見る
感想
まじでイケてない・・・・dockerが流行するのがわかる。rootでインストールできないとかマジでやめてほしい
バージョンアップしたら使えなくなるモジュールが多すぎwww