本家を参考に
下記ブログを参考というか、ほぼそのままインストールをしました。
Redmine 3.4をCentOS 7.3にインストールする手順
http://blog.redmine.jp/articles/3_4/install/centos/
welcom.confを始末していなくて、redmineの画面にならず、ごちゃごちゃ書いてたものを整理したつもりなんですがおかしいところがあったらごめんなさい。
Selinuxの無効化
/etc/sysconfig/selinuxで、SELINUX=enforced を SELINUX=disableに変更
その後リブート
[root@redmine ~]# su
[root@redmine ~]# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@redmine ~]# reboot
firewallにhttpを通す
[root@redmine ~]# firewall-cmd --zone=public --add-service=http --permanent
[root@redmine ~]# firewall-cmd --reload
開発ツールのインストール
CentOS7.5はgroupinstallが変更されたようで、参考のインストール手順ではできなかった点です。
[root@redmine ~]# yum -y groupinstall base "Development tools" --setopt=group_package_types=mandatory,default,optional
RubyとPassengerのビルドに必要なヘッダファイルなどのインストール
[root@redmine ~]# yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel
PostgreSQLとヘッダファイルのインストール
[root@redmine ~]# yum -y install postgresql-server postgresql-devel
Apacheとヘッダファイルのインストール
[root@redmine ~]# yum -y install httpd httpd-devel
ImageMagickとヘッダファイル・日本語フォントのインストール
[root@redmine ~]# yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts
Ruby 2.4最新版のインストール
最新版は、
https://www.ruby-lang.org/ja/downloads/
を参照。
Redmineが対応しているRuby/Railsのバージョンは、
http://www.redmine.org/projects/redmine/wiki/redmineinstall
を参照。
[root@redmine ~]# wget https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.4.tar.gz
[root@redmine ~]# tar zxvf ruby-2.4.4.tar.gz
[root@redmine ruby-2.4.4]# ./configure --disable-install-doc
[root@redmine ruby-2.4.4]# make
[root@redmine ruby-2.4.4]# make install
[root@redmine ruby-2.4.4]# ruby -v
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]
bundlerのインストール
[root@redmine ruby-2.4.4]# gem install bundler --no-rdoc --no-ri
PostgreSQLの設定
[root@redmine ruby-2.4.4]# postgresql-setup initdb
[root@redmine ruby-2.4.4]# vi /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
(略)
[root@redmine ruby-2.4.4]# systemctl start postgresql.service
[root@redmine ruby-2.4.4]# systemctl enable postgresql.service
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql.service to /usr/lib/systemd/system/postgresql.service.
Redmine用ユーザーの作成
[root@redmine ruby-2.4.4]# cd /var/lib/pgsql
[root@redmine pgsql]# sudo -u postgres createuser -P redmine
新しいロールのためのパスワード: (パスワードを設定)
もう一度入力してください: (パスワードを設定)
Redmine用データベースの作成
[root@redmine pgsql]# sudo -u postgres createdb -E UTF-8 -l ja_JP.UTF-8 -O redmine -T template0 redmine
Redmineのインストール
Redmineのダウンロード時に一度失敗したけど、もう一回やったらなんかうまくいった。
[root@redmine pgsql]# svn co https://svn.redmine.org/redmine/branches/3.4-stable /var/lib/redmine
'https://svn.redmine.org:443' のサーバ証明書の認証中にエラーが発生しました:
- 証明書は信頼のおける機関が発行したものではありません。証明書を手動で認証
するためにフィンガープリントを用いてください!
証明書情報:
- ホスト名: svn.redmine.org
- 有効範囲: Sun, 08 Jan 2017 00:00:00 GMT から Wed, 08 Jan 2020 23:59:59 GMT まで
- 発行者: Gandi, Paris, Paris, FR
- フィンガープリント: ab:f1:c8:b7:69:a6:99:bd:20:c1:59:a4:5f:60:9e:27:2d:81:82:b7
拒否しますか (R)、一時的に承認しますか (t)、常に承認しますか (p)? p
svn: E175002: Unable to connect to a repository at URL 'https://svn.redmine.org/redmine/branches/3.4-stable'
svn: E175002: OPTIONS (URL: 'https://svn.redmine.org/redmine/branches/3.4-stable'): Could not read status line: connection was closed by server (https://svn.redmine.org)
[root@redmine pgsql]# svn co https://svn.redmine.org/redmine/branches/3.4-stable /var/lib/redmine
A /var/lib/redmine/test
(略)
Redmineの設定
[root@redmine redmine]# cd /var/lib/redmine/config/
[root@redmine config]# vi database.yml
production:
adapter: postgresql
database: redmine
host: localhost
username: redmine
password: "(Redmineユーザー作成時に設定したパスワード)"
encoding: utf8
[root@redmine config]# vi configuration.yml
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.server.name.co.jp
port: 587
domain: mail.server.name.co.jp
authentication: :login
user_name: UserName@mail.server
password: Password
enable_starttls_auto: false #SSLの場合は不要?
rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
gemパッケージのインストール
[root@redmine config]# cd /var/lib/redmine/
[root@redmine redmine]# bundle install --without development test --path vendor/bundle
(rootでbundleを使うなって警告が出たけどインストールが続く)
Redmineの初期設定と初期データ登録
[root@redmine redmine]# bundle exec rake generate_secret_token
[root@redmine redmine]# RAILS_ENV=production bundle exec rake db:migrate
[root@redmine redmine]# RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data
Passengerのインストール
[root@redmine redmine]# gem install passenger --no-rdoc --no-ri
[root@redmine redmine]# passenger-install-apache2-module --auto --languages ruby
(ぼこぼこ警告出たけどそのまま進行)
[root@redmine redmine]# passenger-install-apache2-module --snippet
LoadModule passenger_module /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.3.4/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.3.4
PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>
Apacheの設定
[root@redmine redmine]# vi /etc/httpd/conf.d/redmine.conf
# Redmineの画像ファイル・CSSファイル等へのアクセスを許可する設定。
# Apache 2.4のデフォルトではサーバ上の全ファイルへのアクセスが禁止されている。
<Directory "/var/lib/redmine/public">
Require all granted
</Directory>
# Passengerの基本設定。
# passenger-install-apache2-module --snippet で表示された設定を記述。
# 環境によって設定値が異なるため以下の5行はそのまま転記せず、必ず
# passenger-install-apache2-module --snippet で表示されたものを使用すること。
#
LoadModule passenger_module /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.3.4/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.3.4
PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>
# 必要に応じてPassengerのチューニングのための設定を追加(任意)。
# 詳しくはPhusion Passenger users guide(https://www.phusionpassenger.com/library/config/apache/reference/)参照。
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 864000
PassengerStatThrottleRate 10
Header always unset "X-Powered-By"
Header always unset "X-Runtime"
[root@redmine ~]# systemctl start httpd.service
[root@redmine ~]# systemctl enable httpd.service
[root@redmine ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since 土 2018-08-04 20:33:54 JST; 1 day 13h ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 1211 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
(略)
(ひとまず進む)
Apache上のPassengerでRedmineを実行するための設定
[root@redmine ~]# chown -R apache:apache /var/lib/redmine
webサーバをRedmine専用として使用する設定
[root@redmine ~]# vi /etc/httpd/conf/httpd.conf
115 # DocumentRoot: The directory out of which you will serve your
116 # documents. By default, all requests are taken from this directory, but
117 # symbolic links and aliases may be used to point to other locations.
118 #
119 #DocumentRoot "/var/www/html"
120 DocumentRoot "/var/lib/redmine/public"
[root@redmine ~]# systemctl restart httpd.service
不要なconfファイルの始末と稼働確認
[root@redmine redmine]# cd /etc/httpd/conf.d
[root@redmine conf.d]# ls *.conf
autoindex.conf django.conf redmine.conf userdir.conf welcome.conf
[root@redmine conf.d]# rm django.conf
[root@redmine conf.d]# mv welcome.conf welcome.conf.bak
[root@redmine conf.d]# systemctl restart httpd.service