이전 사이트에서 글을 옮기면서 보니 너무 복잡한 설치방법이다. 이제 Docker 이제 한 줄 실행하면 실행되기 때문이다. 추억 삼아 올려본다.

Redmine?

이슈 트래커 중 유명한 도구

글 히스토리

  • 2016-08-11
    • 리눅스환경, 패키지 버전에 따라 예전에 블로그를 따라 하면 됐던게 몇달 지난 후 똑같이 따라하면 안된다.
  • 2013-11-23
    • 레드마인은 현재시점 최신버전인 2.4.1 (r. 2013-11-23)을 설치한다.
    • 그리고 기존에 사용했던 레드마인 DB와 Files를 마이그레이션 할 것이다.

설치구성환경

  • CentOS 7.0 64bit
  • Redmine 3.3.0
  • MariaDB 10.1.2

설치순서

CentOS 설정

1. SELinux를 Disable

  • 보안관련이라고 하는데 골칫덩어리라고 한다. Redmine.or.kr 에서는 이를 비활성화시키라고 해서 그렇게 해보려고 보니 이미 Disabled되어 있었다.
  • 확인: getenforce
  • 경로: /etc/sysconfig/selinux (실제 경로는 /etc/selinux/config) 에서 config
BASH
# 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
  • 쉽게 이 명령으로 바꿀 수 있다. (파일내용 중 s/ 이하에 있는 내용을 /~~/g ~~로 변경할 수 있는 명령이다.)
BASH
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config

2. 방화벽 Port 허용: 기본적으로 Redmine은 3000번 포트를 사용하기에 추가한다.

BASH
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT

설치진행

1. EPEL(Extra Package for Enterprise Linux repository configuration) 설치

BASH
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

2. 개발툴 설치

BASH
yum -y groupinstall "Development Tools"

3. Ruby와 Passenger 빌드에 필요한 헤더파일

BASH
yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel

4. MariaDB와 헤더파일

BASH
yum -y install mariadb-server mariadb-devel

5. Apache와 헤더파일

BASH
yum -y install httpd httpd-devel

6. ImageMagick과 헤더파일

BASH
yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts

7. Ruby 설치

  • 소스다운받는 방식의 1.9.3 설치순서 (http://www.ruby-lang.org/ko/downloads)
BASH
curl -O https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.gz tar xvf ruby-2.2.3.tar.gz cd ruby-2.2.3 ./configure --disable-install-doc make make install cd ..

8. Bundler 설치

BASH
gem install bundler --no-rdoc --no-ri

9. MariaDB 설정

BASH
vi /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd character-set-server=utf8 [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid [mysql] default-character-set=utf8 # # include all files from the config directory # !includedir /etc/my.cnf.d

9-1. MySQL 시작 및 자동시작

BASH
service mariadb start systemctl enable mariadb

9-2. MySQL root패스워드 설정

BASH
mysql_secure_installation /usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): (Enter) OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] Y New password: ??? (암호입력) Re-enter new password: ??? (암호재확인) Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y (root로그인을 원격지에서 못하게) ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y (테스트 DB삭제여부) - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!

9-3. Redmine용 데이터베이스 생성 및 사용자 생성

BASH
mysql -u root -p Enter password: [암호입력] Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 5.5.47-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database db_redmine default character set utf8; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all on db_redmine.* to user_redmine identified by '[암호입력]'; Query OK, 0 rows affected (0.01 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye

Redmine 설치

BASH
svn co http://svn.redmine.org/redmine/branches/3.3-stable /var/lib/redmine cd /var/lib/redmine/config cp database.yml.example database.yml vi database.yml production: adapter: mysql2 database: db_redmine #데이터베이스 이름 입력 host: localhost username: root #사용자 계정입력 password: "[암호입력]" encoding: utf8
  • 위 부분을 찾아서 자신의 환경에 맞게 수정한다.

메일 접속 설정

BASH
cp configuration.yml.example configuration.yml vi configuration.yml ~~~ rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
  • 위 부분을 찾아서 자신의 환경에 맞게 수정한다.

Gem Package 설치

BASH
bundle install --without development test postgresql sqlite rmagick

레드마인 테이블 생성 및 초기 데이터 입력

신규 설치 일 경우

BASH
bundle exec rake generate_secret_token RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production REDMINE_LANG=ko bundle exec rake redmine:load_default_data

업그레이드 (기존자료 복원) 일 경우

  • 기존 파일들은 레드마인 새로 설치한 곳의 files에 풀어서 넣는다.
  • 백업한 DB를 복원한다.
BASH
./mysqldump -u root -p intranet > /home/eight256/intranet.sql # 백업 ./mysql -u root -p intranet < /home/eight256/intranet.sql # 복원
  • 업그레이드
BASH
rake generate_secret_token rake db:migrate RAILS_ENV=production rake tmp:cache:clear rake tmp:sessions:clear

Passenger 설치

BASH
gem install passenger --no-rdoc --no-ri passenger-install-apache2-module --auto

Apache 설정

BASH
passenger-install-apache2-module --snippet
이 명령의 결과를 복사 해놓고 아래 파일에 LoadModule로 시작되는 내용을 넣은 것처럼 넣는다. 시점에 따라 버전이 바뀔 수 있다. (아래파일은 httpd.conf 경로 내에 새로 생성되는 파일로 같은 폴더에 있으면 Apache가 알아서 설정값을 가져가 load된다고 한다.)
BASH
vi /etc/httpd/conf.d/redmine.conf <Directory "/var/lib/redmine/public"> Require all granted </Directory> LoadModule passenger_module /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.30/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.30 PassengerDefaultRuby /usr/local/bin/ruby </IfModule> Header always unset "X-Powered-By" Header always unset "X-Runtime" PassengerMaxPoolSize 20 PassengerMaxInstancesPerApp 4 PassengerPoolIdleTime 864000 PassengerHighPerformance on PassengerStatThrottleRate 10 PassengerSpawnMethod smart PassengerFriendlyErrorPages off

httpd.conf 파일 설정

BASH
vi /etc/httpd/conf/httpd.conf DocumentRoot "/var/www/html" DocumentRoot "/var/lib/redmine/public" ServerName localhost

기타권한 설정

BASH
chown -R apache:apache /var/lib/redmine ln -s /var/lib/redmine/public /var/www/html/redmine

Apache 서버 가동

BASH
service httpd start systemctl enable httpd

레드마인 추가 작업

상단 Top Menu의 폰트 크기가 너무 작아요.

BASH
# 언어가 영문이면 이상이 없는데 한글로 하면 작아진다. # [레드마인설치위치]/public/stylesheets/application.css를 열어보자. #top-menu {background: #3E5B76; color: #fff; height:1.8em; font-size: 0.8em; padding: 2px 2px 0px 6px;} 요 줄에서 0.81.0으로 변경한다.

한글화 된 용어 중 "일감"을 다른 말로 바꾸고 싶어요.

BASH
[레드마인설치위치]/config/locales/ko.yml을 열어보자. 바꾸고 싶은 단어를 바꾸면된다.