CentOS7.5에 Redmine3.4.6 설치

CentOS7.5에 Redmine3.4.6 설치

2022-10-06 last update

10 minutes reading Redmine centos7

본가를 참고로



하기 블로그를 참고라고 하는지, 거의 그대로 인스톨을 했습니다.

Redmine 3.4를 CentOS 7.3에 설치하는 단계
htp : // bg. 어 d 미네. jp/아르치 c㎇s/3_4/인 s타르/전과 s/

welcom.conf를 시작하지 않고, redmine의 화면이 되지 않고, 엉망진창 쓰고 있던 것을 정리할 생각입니다만 이상한 곳이 있으면 미안해.

Selinux 비활성화



/etc/sysconfig/selinux에서 SELINUX=enforced를 SELINUX=disable로 변경
그 후 재부팅
[[email protected] ~]# su
[[email protected] ~]# 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

[[email protected] ~]# reboot

firewall에 http를 통해


[[email protected] ~]# firewall-cmd --zone=public --add-service=http --permanent
[[email protected] ~]# firewall-cmd --reload

개발 도구 설치



CentOS7.5는 groupinstall이 변경된 것 같고 참고 설치 절차로는 할 수 없었던 점입니다.
[[email protected] ~]# yum -y groupinstall base "Development tools" --setopt=group_package_types=mandatory,default,optional

Ruby 및 Passenger 빌드에 필요한 헤더 파일과 같은 설치


[[email protected] ~]# yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel

PostgreSQL 및 헤더 파일 설치


[[email protected] ~]# yum -y install postgresql-server postgresql-devel

Apache 및 헤더 파일 설치


[[email protected] ~]# yum -y install httpd httpd-devel

ImageMagick 및 헤더 파일, 일본어 글꼴 설치


[[email protected] ~]# yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts

Ruby 2.4 최신 버전 설치



최신판은
htps //w w. 루 by ぁん g. 오 rg / 그럼 / 어쩌면 ds /
참조.
Redmine이 지원하는 Ruby/Rails 버전은
h tp // w w. 어 d 미네. 오 rg / p 로지 cts / re d mine / uki / re d minein s ta l
참조.
[[email protected] ~]# wget https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.4.tar.gz
[[email protected] ~]# tar zxvf ruby-2.4.4.tar.gz 
[[email protected] ruby-2.4.4]# ./configure --disable-install-doc
[[email protected] ruby-2.4.4]# make
[[email protected] ruby-2.4.4]# make install
[[email protected] ruby-2.4.4]# ruby -v
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]

bundler 설치


[[email protected] ruby-2.4.4]# gem install bundler --no-rdoc --no-ri

PostgreSQL 설정


[[email protected] ruby-2.4.4]# postgresql-setup initdb
[[email protected] 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
(略)
[[email protected] ruby-2.4.4]# systemctl start postgresql.service
[[email protected] 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용 사용자 만들기


[[email protected] ruby-2.4.4]# cd /var/lib/pgsql
[[email protected] pgsql]# sudo -u postgres createuser -P redmine
新しいロールのためのパスワード:  (パスワードを設定)
もう一度入力してください:  (パスワードを設定)


Redmine용 데이터베이스 만들기


[[email protected] pgsql]# sudo -u postgres createdb -E UTF-8 -l ja_JP.UTF-8 -O redmine -T template0 redmine

Redmine 설치



Redmine 다운로드시 한 번 실패했지만, 다시 한번 하면 뭔가 잘 됐다.
[[email protected] 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)


[[email protected] pgsql]# svn co https://svn.redmine.org/redmine/branches/3.4-stable /var/lib/redmine
A    /var/lib/redmine/test
(略)

Redmine 설정


[[email protected] redmine]# cd /var/lib/redmine/config/
[[email protected] config]# vi database.yml

production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: "(Redmineユーザー作成時に設定したパスワード)"
  encoding: utf8

[[email protected] 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: [email protected]
      password: Password
      enable_starttls_auto: false #SSLの場合は不要?

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


gem 패키지 설치


[[email protected] config]# cd /var/lib/redmine/
[[email protected] redmine]# bundle install --without development test --path vendor/bundle
(rootでbundleを使うなって警告が出たけどインストールが続く)

Redmine의 초기 설정 및 초기 데이터 등록


[[email protected] redmine]# bundle exec rake generate_secret_token
[[email protected] redmine]# RAILS_ENV=production bundle exec rake db:migrate
[[email protected] redmine]# RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data

Passenger 설치


[[email protected] redmine]# gem install passenger --no-rdoc --no-ri
[[email protected] redmine]# passenger-install-apache2-module --auto --languages ruby
(ぼこぼこ警告出たけどそのまま進行)
[[email protected] 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>


아파치 설정


[[email protected] 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"

[[email protected] ~]# systemctl start httpd.service
[[email protected] ~]# systemctl enable httpd.service
[[email protected] ~]# 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을 실행하기위한 설정


[[email protected] ~]# chown -R apache:apache /var/lib/redmine

웹 서버를 Redmine 전용으로 사용하는 설정


[[email protected] ~]# 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"

[[email protected] ~]# systemctl restart httpd.service

불필요한 conf 파일의 시작과 작동 확인


[[email protected] redmine]# cd /etc/httpd/conf.d
[[email protected] conf.d]# ls *.conf
autoindex.conf  django.conf  redmine.conf  userdir.conf  welcome.conf
[[email protected] conf.d]# rm django.conf
[[email protected] conf.d]# mv welcome.conf welcome.conf.bak
[[email protected] conf.d]# systemctl restart httpd.service