오픈소스

CentOS 7 Redmine 4.1 설치

 케이군  2020. 2. 11. 11:11

 

프로젝트 관리 툴인 Redmine 최신 버전인 4.1.0 설치하였습니다.

레드마인 홈페이지에서 인스톨 가이드를 보고 작성하였습니다.

 


OS : CentOS7

DB : MariaDB 10.4.10-1

Ruby : 2.6.5

Ruby-gems : 3.1.2


1. MariaDB 설치

MariaDB 최신 안정화 버전인 10.4를 기준으로 설치를 하였습니다.

/etc/yum.repos.d 경로에 MariaDB.repo 파일을 작성하여 아래 내용을 추가합니다.

# MariaDB 10.4 CentOS repository list - created 2020-02-11 01:25 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

서버와 클라이언트 그리고 Ruby에서 DB 연동을 위한 공유 라이브러리를 추가로 설치합니다.

# yum install MariaDB-server MariaDB-client MariaDB-shared MariaDB-devel

서비스 시작 및 부팅시 실행되도록 설정합니다.

# systemctl start mariadb
# systemctl enable mariadb

Redmine에서 사용할 데이터베이스와 서비스용 계정을 생성합니다.

# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 180212752
Server version: 10.4.10-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET utf8;
Query OK, 1 row affected (0.002 sec)

MariaDB [(none)]> GRANT ALL ON redmine.* TO 'redmine'@'localhost' identified BY 'redmine';
Query OK, 0 rows affected (0.007 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.003 sec)

MariaDB [(none)]> Bye

 

2. Ruby 설치

레드마인은 Ruby로 개발된 프로그램으로써 필수로 Ruby를 설치하여야 합니다.

현재 4.1 버전에서는 2.6버전까지 지원을 하고 있습니다.

 

 

 

EPLE repository를 통해 Ruby를 설치할 경우 2.0버전이 설치되기 때문에 소스 컴파일을 통해 설치를 진행하였습니다.

최신 릴리즈는 2.7이지만 Redmine에서 지원하지 않기 때문에 2.6.5버전으로 설치를 진행하였습니다.

 

소스 컴파일을 하기 위해 개발자 도구와 Redmine에 필요한 라이브러리를 설치합니다.

# sudo yum -y groupinstall "Development Tools"
# # yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick

Ruby를 /usr/local/src 경로에 다운로드 받아 컴파일을 진행합니다.

# cd /usr/local/src
# wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.gz
# tar xvf ruby-2.6.5.tar.gz
# cd ruby-2.6.5
# ./configure 
# make && make install
# ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]

Ruby-gems 도 마찬가지로 설치를 진행합니다.

# wget https://rubygems.org/rubygems/rubygems-3.1.2.tgz
# tar xvf rubygems-3.1.2.tgz
# cd rubygems-3.1.2
# /usr/local/bin/ruby setup.rb

bundler, chef ruby-shadow 설치를 진행합니다.

bundler(번들러)는 Ruby 어플리케이션을 위한 일관된 환경을 관리를 하게 됩니다.

# gem install bundler chef ruby-shadow

Gem을 이용하여 OpenID와 mysql2를 설치합니다.

# gem install ruby-openid
Fetching ruby-openid-2.9.2.gem
Successfully installed ruby-openid-2.9.2
Parsing documentation for ruby-openid-2.9.2
Installing ri documentation for ruby-openid-2.9.2
Done installing documentation for ruby-openid after 1 seconds
1 gem installed

# gem install mysql2
Building native extensions. This could take a while...
Successfully installed mysql2-0.5.3
Parsing documentation for mysql2-0.5.3
Installing ri documentation for mysql2-0.5.3
Done installing documentation for mysql2 after 0 seconds
1 gem installed

 

3. Redmine 설치

설치할 경로에 Redmine을 다운로드 하고 압축을 풀어줍니다.

# cd /usr/local/src
# wget https://www.redmine.org/releases/redmine-4.1.0.tar.gz
# tar xvfz redmine-4.1.0.tar.gz

기본 설정파일 복사 및 DB 연결 설정

# cd redmine-4.1.0
# cp config/configuration.yml.example config/configuration.yml
# cp config/database.yml.example config/database.yml
# vim config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8

구동에 필요한 패키지 설치

# bundle install --without development test --path vendor/bundle

쿠키 암호화를 위한 시크릿 토큰 생성

# bundle exec rake generate_secret_token

데이터베이스 생성

# RAILS_ENV=production bundle exec rake db:migrate

기본 언어 설정 ko를 입력

# RAILS_ENV=production bundle exec rake redmine:load_default_data

Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] ko
====================================
Default configuration data loaded.

실행

# bundle exec rails server webrick -e production -b 0.0.0.0 &

http://your-ip:3000 을 통해 접속 가능

 

 

Apache Passenger를 이요하여 아파치로 연동을 해서 사용을 합니다.

# yum -y install httpd libcurl-devel httpd-devel apr-devel apr-util-devel

gem을 통해 passenger를 설치를 합니다.

# gem install passenger
Fetching: passenger-5.1.12.gem (100%)
Building native extensions.  This could take a while...
Successfully installed passenger-5.1.12
Parsing documentation for passenger-5.1.12
Installing ri documentation for passenger-5.1.12
Done installing documentation for passenger after 46 seconds
1 gem installed

passenger를 통해 아파치 모듈을 설치합니다.

# passenger-install-apache2-module

/etc/httpd/conf.d/redmine.conf 파일에 passenger모듈 추가하고 vhost를 추가합니다. 

LoadModule passenger_module /usr/local/lib/ruby/gems/2.6.0/gems/passenger-6.0.4/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/lib/ruby/gems/2.6.0/gems/passenger-6.0.4
  PassengerDefaultRuby /usr/local/bin/ruby
  PassengerDefaultUser apache
</IfModule>

<VirtualHost *:80>
  ServerName redmine.com
  DocumentRoot /usr/local/redmine/public
  ErrorLog logs/redmine_error_log
    <Directory "/usr/local/src/redmine-4.1.0/public">
        Options FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
  Options Indexes FollowSymLinks MultiViews
  RailsEnv production
  RailsBaseURI /
</VirtualHost>