본문 바로가기
다물칸 주소복사
조회 수 8432 추천 수 0 댓글 2
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
구분 강좌
출처 내가작성

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

# 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 ~~로 변경할 수 있는 명령이다.)

sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config

 

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

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

 

설치진행

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

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

 - 설치완료

 

2. 개발툴 설치

yum -y groupinstall "Development Tools"

 - 설치완료. 104메가나 된다.

 

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

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

 - 설치완료. 15메가

 

4. MySQL과 헤더파일

yum -y install mariadb-server mariadb-devel

 - 설치완료. 25메가 

 

5. Apache와 헤더파일

yum -y install httpd httpd-devel

 - 설치완료. 12메가 

 

6. ImageMagick과 헤더파일

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

 - 설치완료. 52메가

 

7. Ruby 설치

 - 소스다운받는 방식의 1.9.3 설치순서

http://www.ruby-lang.org/ko/downloads/

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 설치

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

 

9. MySQL 설정

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

 - 각각 추가후 저장한다. (i - 추가 / esc누르고 :wq - 저장)

mySQL 시작 및 자동시작

service mariadb start
systemctl enable mariadb

 

mySQL root암호설정

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!

 

Redmine용 데이터베이스 생성 및 유저생성

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

 

10. 레드마인 설치

공식설치방법 : http://www.redmine.org/projects/redmine/wiki/RedmineInstall  

최신버전 : http://www.redmine.org/projects/redmine/wiki/Download

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

- 위 부분을 찾아서 자신의 환경설정에 맞게 수정한다. 

 

메일 접속설정

cp configuration.yml.example configuration.yml
vi configuration.yml


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

 - 위 부분을 찾아서 자신의 환경설정에 맞게 수정한다.

 

11. Gem Package 설치

bundle install --without development test postgresql sqlite rmagick

 

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

신규설치

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에 풀어넣는다.

./mysqldump -u root -p intranet > /home/eight256/intranet.sql # 백업
./mysql -u root -p intranet < /home/eight256/intranet.sql  # 복원

 - 백업한 디비를 복원한다.

rake generate_secret_token
rake db:migrate RAILS_ENV=production 
rake tmp:cache:clear
rake tmp:sessions:clear

 

13. Passenger 설치

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

 

14. Apache 설정

passenger-install-apache2-module --snippet


이 명령의 결과를 복사 해놓고 아래 파일에 LoadModule로 시작되는 내용을 넣은 것처럼 넣는다. 시점에 따라 버전이 바뀔 수 있다. (아래파일은 httpd.conf 경로 내에 새로 생성되는 파일로 같은 폴더에 있으면 Apache가 알아서 설정값을 가져가 load된다고 한다.)

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 파일 설정

vi /etc/httpd/conf/httpd.conf

DocumentRoot "/var/www/html"
↓
DocumentRoot "/var/lib/redmine/public"

ServerName localhost
 

 

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

 

15. 아파치 서버 가동

service httpd start
systemctl enable httpd

 

레드마인 추가작업

 

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

 

언어가 영문이면 이상이 없는데 한글로 하면 엄청 작다.

[레드마인설치위치]/public/stylesheets/application.css를 열어보자.

#top-menu {background: #3E5B76; color: #fff; height:1.8em; font-size: 0.8em; padding: 2px 2px 0px 6px;}

요 줄에서 0.8을 1.0으로 변경한다.

 

2. 한글화 된 용어 중 "일감"을 다른 말로 바꾸고 시포.

 

[레드마인설치위치]/config/locales/ko.yml을 열어보자.

바꾸고 싶은 단어를 바꾸면된다.

  • ?
    다물칸 2013.12.23 11:03
    webbrick로 안했던 것 같은데... 이걸로 하면 터미널을 계속 띄어놓아야 한다.
    서비스 형태로 올려야 하는디... 게다가 ... 0.0.0.0:3000은 뭔가? 그래서 지금 접속은 안된다.
  • ?
    다물칸 2013.12.23 13:04
    Passenger로 올리는데 성공은 했다. 그런데 일부 WIKI페이지들과 Setting등이 Internal Error가 뜬다.
    디비 쫑이 난건지 뭔지 알길이 없다.