Rocky Linux 8에 Redmine 프로젝트 관리 소프트웨어를 설치하는 방법
이 페이지에서
- 전제 조건
- 1단계 - 방화벽 구성\n
- 2단계 - Apache 서버 설치
- 3단계 - MySQL 서버 설치 및 구성
- 4단계 - EPEL 저장소 설치
- 5단계 - Ruby 및 기타 필수 구성 요소 설치\n
- 6단계 - Redmine 설치
- 7단계 - Phusion Passenger 설치
- Apache 서버 구성
- Apache 수신 포트 변경
- Nginx 구성
Redmine은 무료 오픈 소스 프로젝트 관리 소프트웨어 및 문제 추적 도구입니다. Ruby on Rails 프레임워크를 사용하여 작성되었으며 다양한 버전 제어 시스템과 통합될 수 있습니다. 여기에는 리포지토리 브라우저와 diff 뷰어가 포함됩니다. 프로젝트 위키 및 포럼, 시간 추적 및 역할 기반 액세스 제어별로 프로젝트 기능을 관리하는 데 사용할 수 있습니다. 크로스 플랫폼, 크로스 데이터베이스이며 49개 언어를 지원합니다.
이 튜토리얼에서는 Rocky Linux 8 기반 서버에 Redmine을 설치하는 방법을 배웁니다.
전제 조건
-
A Server running Rocky Linux.
-
A non-sudo user with root privileges.
-
Disable SELinux.
-
Everything is updated.
$ sudo dnf update
1단계 - 방화벽 구성
첫 번째 단계는 방화벽을 구성하는 것입니다. Rocky Linux는 Firewalld Firewall을 사용합니다. 방화벽 상태를 확인하십시오.
$ sudo firewall-cmd --state running
Redmine을 확인하는 데 사용할 수 있는 포트 3000을 엽니다.
$ sudo firewall-cmd --permanent --add-port=3000
HTTP 및 HTTPS 포트를 허용합니다.
$ sudo firewall-cmd --permanent --add-service=http $ sudo firewall-cmd --permanent --add-service=https
변경 사항을 적용하려면 방화벽을 다시 로드하십시오.
$ sudo firewall-cmd --reload
2단계 - Apache 서버 설치
Apache 웹 서버를 사용하여 Redmine을 배포합니다. 다음 명령을 사용하여 Apache를 설치합니다.
$ sudo dnf install httpd
Apache 서비스를 활성화하고 시작합니다.
$ sudo systemctl enable --now httpd.service
/var/www/redmine
디렉토리에 필요한 액세스 권한을 갖도록 현재 로그인한 사용자를 apache 사용자에게 부여합니다.$ sudo usermod -aG $USER apache
3단계 - MySQL 서버 설치 및 구성
우리는 데이터를 저장하기 위해 MySQL 데이터베이스를 사용할 것입니다. Rocky Linux의 Appstream 리포지토리는 최신 버전의 MySQL과 함께 제공됩니다.
MySQL을 설치합니다.
$ sudo dnf install mysql-server
MySQL 서비스를 활성화하고 시작합니다.
$ sudo systemctl enable mysqld --now
안전한 MySQL 설치.
$ sudo mysql_secure_installation
첫 번째 단계에서는 MySQL 암호의 강도를 테스트하는 데 사용할 수 있는 암호 유효성 검사 플러그인을 설정할지 묻는 메시지가 표시됩니다. 계속하려면
Y
를 선택하십시오. 다음 단계에서 암호 유효성 검사 수준을 선택하라는 메시지가 표시됩니다. 가장 강력한 수준인2
를 선택하고 비밀번호는 최소 8자 이상이어야 하며 대문자, 소문자, 숫자 및 특수 문자를 혼합해야 합니다.Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: Y There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
다음 단계에서 루트 암호를 선택하라는 메시지가 표시됩니다. 암호 유효성 검사 플러그인의 요구 사항을 충족하는 강력한 암호를 선택하십시오. 다음 단계에서는 선택한 암호를 계속 사용할 것인지 묻는 메시지가 표시됩니다. 계속하려면
y
를 누르십시오.Please set the password for root here. New password: Re-enter new password: Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y
Y
를 누른 다음 다음 프롬프트에 대해ENTER
키를 눌러 익명 사용자 및 테스트 데이터베이스를 제거하고 루트 로그인을 비활성화하고 새로 설정된 규칙을 로드합니다.... Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Success. ... Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y Success. ... Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y - 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? (Press y|Y for Yes, any other key for No) : Y Success. All done!
MySQL 쉘을 입력하십시오. 계속하려면 루트 암호를 입력하십시오.
$ mysql -u root -p
redmine
사용자를 생성합니다. 암호가 이전에 설정된 요구 사항을 충족하는지 확인하십시오.mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'Your_password2';
redmine
데이터베이스를 생성합니다.mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;
redmine
데이터베이스에 대한 사용자 권한을 부여합니다.mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
셸을 종료합니다.
mysql> exit
4단계 - EPEL 리포지토리 설치
Redmine에 필요한 일부 패키지는 EPEL 저장소에서 사용할 수 있습니다. 다음 명령을 실행하여 EPEL 리포지토리를 설치합니다.
$ sudo dnf install epel-release
PowerTools 리포지토리를 활성화합니다.
$ sudo dnf config-manager --set-enabled powertools
5단계 - Ruby 및 기타 필수 구성 요소 설치
Rocky Linux 8은 2.5, 2.6, 2.7 및 3.0의 네 가지 버전의 Ruby와 함께 제공됩니다.
사용 가능한 모든 Ruby 모듈을 나열합니다.
$ dnf module list ruby Last metadata expiration check: 0:18:58 ago on Mon 03 Jan 2022 11:50:10 AM UTC. Rocky Linux 8 - AppStream Name Stream Profiles Summary ruby 2.5 [d] common [d] An interpreter of object-oriented scripting language ruby 2.6 common [d] An interpreter of object-oriented scripting language ruby 2.7 common [d] An interpreter of object-oriented scripting language ruby 3.0 common [d] An interpreter of object-oriented scripting language Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Redmine 최신 버전은 3.0을 제외한 모든 버전과 호환됩니다. 튜토리얼을 위해 Ruby 2.7을 설치합니다.
다른 버전을 재설정하고 Ruby 2.7 버전을 활성화하십시오.
$ sudo dnf module reset ruby $ sudo dnf module enable ruby:2.7
루비를 설치합니다.
$ sudo dnf install ruby ruby-devel
설치를 확인하십시오.
$ ruby -v ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
Redmine에 필요한 나머지 패키지를 모두 설치합니다.
$ sudo dnf install rpm-build wget libxml2-devel make automake libtool ImageMagick ImageMagick-devel mariadb-devel httpd-devel openssl-devel libcurl-devel gcc gcc-c++
6단계 - Redmine 설치
Redmine 다운로드 페이지를 방문하여 사용 가능한 최신 안정 버전을 확인하십시오. 이 튜토리얼을 작성할 당시 사용 가능한 최신 버전은 4.2.3입니다.
wget
을 사용하여 Redmine을 다운로드합니다.$ wget https://redmine.org/releases/redmine-4.2.3.tar.gz
파일을 추출하여
/var/www/redmine
디렉토리로 이동합니다.$ tar xfz redmine-4.2.3.tar.gz $ sudo mv redmine-4.2.3 /var/www/redmine
/var/www/redmine
디렉토리로 이동합니다.$ cd /var/www/redmine
제공된 예제 파일을 사용하여 Redmine 구성 파일을 만듭니다.
$ cp config/configuration.yml.example config/configuration.yml $ cp config/database.yml.example config/database.yml $ cp public/dispatch.fcgi.example public/dispatch.fcgi
편집을 위해
database.yml
파일을 엽니다.$ nano config/database.yml
다음 섹션에서 데이터베이스 설정을 찾아 구성합니다.
production: adapter: mysql2 database: redmine host: localhost username: redmine password: "Your_password2" # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7 encoding: utf8mb4
Ctrl + X를 누르고 메시지가 표시되면 Y를 입력하여 파일을 저장합니다.
ruby gem 종속성을 관리하기 위해 번들러를 설치합니다.
$ gem install bundler
gem 의존성을 설치하기 위한 환경을 설정합니다.
$ bundle config set --local without 'development test'
gem 종속성을 설치합니다.
$ bundle install
gem 버전에 문제가 있는 경우 다음 명령을 사용하여 복원하십시오.
$ sudo gem pristine --all
세션 데이터를 저장하기 위한 쿠키의 변조를 방지하기 위해 임의의 비밀 키를 생성합니다.
$ bundle exec rake generate_secret_token
데이터베이스 구조를 만듭니다.
$ RAILS_ENV=production bundle exec rake db:migrate
데이터를 MySQL 데이터베이스에 삽입합니다.
$ RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data
필요한 디렉토리를 생성하고 파일 권한을 설정합니다.
$ mkdir -p tmp/pdf $ mkdir -p public/plugin_assets $ chown -R $USER:$USER files log tmp public/plugin_assets $ chmod -R 755 /var/www/remine/
다음 명령을 실행하여 Rails 서버 인스턴스를 시작하십시오.
$ bundle exec rails server webrick -e production => Booting WEBrick => Rails 5.2.6 application starting in production on http://0.0.0.0:3000 => Run `rails server -h` for more startup options [2022-01-03 12:58:19] INFO WEBrick 1.6.1 [2022-01-03 12:58:19] INFO ruby 2.7.4 (2021-07-07) [x86_64-linux] [2022-01-03 12:58:19] INFO WEBrick::HTTPServer#start: pid=117224 port=3000
URL
http://
을 열어 Redmine 로그인 화면을 얻습니다.:3000/login 기본 자격 증명(admin/admin)을 입력하여 로그인합니다. 비밀번호를 변경하라는 메시지가 표시됩니다.
다음으로 내 계정 페이지로 리디렉션됩니다.
Redmine이 성공적으로 설치되었습니다.
그런 다음 터미널에서 CTRL+C를 눌러 서버를 중지합니다.
7단계 - Phusion Passenger 설치
Phusion Passenger는 타사 서버를 통해 Redmine을 제공할 수 있는 루비 응용 프로그램 서버입니다. 우리의 경우 Apache를 사용합니다.
승객을 설치합니다.
$ gem install passenger
Apache 서버용 패신저 모듈을 설치합니다.
$ passenger-install-apache2-module
환영 메시지가 표시됩니다. 계속하려면 Enter 키를 누르십시오.
Welcome to the Phusion Passenger Apache 2 module installer, v6.0.12. This installer will guide you through the entire installation process. It shouldn't take more than 3 minutes in total. Here's what you can expect from the installation process: 1. The Apache 2 module will be installed for you. 2. You'll learn how to configure Apache. 3. You'll learn how to deploy a Ruby on Rails application. Don't worry if anything goes wrong. This installer will advise you on how to solve any problems. Press Enter to continue, or Ctrl-C to abort. --------------------------------------------
다음으로 언어를 묻는 메시지가 표시됩니다. Ruby가 기본적으로 선택되어 있으므로 계속하려면 Enter 키를 누르십시오.
Which languages are you interested in? Use <space> to select. If the menu doesn't display correctly, press '!' ? ? Ruby ? Python ? Node.js ? Meteor --------------------------------------------
파일 권한에 대한 경고가 표시될 수 있습니다. 튜토리얼을 따라왔다면 Enter 키를 눌러 계속 진행하세요.
Warning: some directories may be inaccessible by the web server! The web server typically runs under a separate user account for security reasons. That user must be able to access the Phusion Passenger(R) files. However, it appears that some directories have too strict permissions. This may prevent the web server user from accessing Phusion Passenger(R) files. It is recommended that you relax permissions as follows: sudo chmod o+x "/home/navjot" Press Ctrl-C to return to the shell. (Recommended) After relaxing permissions, re-run this installer. -OR- Press Enter to continue anyway.
전체 프로세스를 완료하는 데 약 10-15분이 소요됩니다. 다음과 같은 오류가 발생하면 RAM이 부족할 가능성이 큽니다. 서버의 RAM을 늘리거나 스왑 공간을 설치해야 합니다.
c++: fatal error: Killed signal terminated program cc1plus compilation terminated. rake aborted!
프로세스가 완료되면 다음 메시지가 표시됩니다.
-------------------------------------------- Almost there! Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /home/navjot/.gem/ruby/gems/passenger-6.0.12/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /home/navjot/.gem/ruby/gems/passenger-6.0.12 PassengerDefaultRuby /usr/bin/ruby </IfModule> After you restart Apache, you are ready to deploy any number of web applications on Apache, with a minimum amount of configuration! Press ENTER when you are done editing.
아직 Enter 키를 누르지 마십시오. 현재 사용자로 서버에서 새 세션을 열고 다음 구성을 수행하십시오.
아파치 서버 구성
Phusion Passenger용 Apache 모듈 구성 파일을 생성합니다.
$ sudo nano /etc/httpd/conf.modules.d/00-passenger.conf
승객 설치가 끝날 때 받은 코드를 붙여넣습니다.
LoadModule passenger_module /home/navjot/.gem/ruby/gems/passenger-6.0.12/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /home/username/.gem/ruby/gems/passenger-6.0.12 PassengerDefaultRuby /usr/bin/ruby </IfModule>
Ctrl + X를 누르고 메시지가 표시되면 Y를 입력하여 파일을 저장합니다.
Redmine 사이트에 대한 다른 Apache 구성 파일을 만듭니다.
$ sudo nano /etc/httpd/conf.d/redmine.conf
다음 코드를 붙여넣습니다.
Listen 3000 <IfModule mod_passenger.c> PassengerRoot /home/username/.gem/ruby/gems/passenger-6.0.12 PassengerDefaultRuby /usr/bin/ruby </IfModule> <VirtualHost *:3000> ServerName redmine.example.com DocumentRoot "/var/www/redmine/public" CustomLog logs/redmine_access.log combined ErrorLog logs/redmine_error_log LogLevel warn <Directory "/var/www/redmine/public"> Options Indexes ExecCGI FollowSymLinks Require all granted AllowOverride all </Directory> </VirtualHost>
Ctrl + X를 누르고 메시지가 표시되면 Y를 입력하여 파일을 저장합니다.
편집을 위해 기본 Apache 구성 파일
/etc/httpd/conf/httpd.conf
를 엽니다.$ sudo nano /etc/httpd/conf/httpd.conf
변수
ServerName
을 찾아 앞의 해시(#)를 제거하고 해당 값을 다음과 같이 설정하여 주석을 해제합니다.ServerName localhost
Ctrl + X를 누르고 메시지가 표시되면 Y를 입력하여 파일을 저장합니다.
Apache 구성을 확인하십시오.
$ httpd -t Syntax OK
Passenger 설치를 계속하려면 돌아가서 Enter를 누르십시오. 몇 가지 검사를 수행하며 성공적으로 완료되면 다음 메시지가 표시되어야 합니다.
Deploying a web application To learn how to deploy a web app on Passenger, please follow the deployment guide: https://www.phusionpassenger.com/library/deploy/apache/deploy/ Enjoy Phusion Passenger, a product of Phusion® (www.phusion.nl) :-) https://www.phusionpassenger.com Passenger® is a registered trademark of Phusion Holding B.V.
Apache 서버를 다시 시작하십시오.
$ sudo systemctl restart httpd
귀하의 웹사이트는
http://redmine.example.com:3000
에서 사용할 수 있어야 합니다.이것은 Redmine에 액세스하는 완벽한 방법이 아닙니다. 여전히 안전하지 않은 HTTP 프로토콜을 통해 제공되고 있으며 포트 번호를 사용합니다. Nginx를 역방향 프록시로 설치하고 이를 개선하기 위해 HTTPS 프로토콜을 사용하여 Redmine을 제공할 것입니다. Nginx 설치 및 구성으로 이동하기 전에 SSL 인증서를 설정해야 합니다.
8단계 - SSL 설치
Lets Encrypt를 사용하여 SSL 인증서를 설치하려면 Certbot 도구를 설치해야 합니다. 다음 명령을 실행하여 Certbot을 설치합니다.
$ sudo dnf install certbot
Apache 서버를 중지합니다.
$ sudo systemctl stop httpd
SSL 인증서를 생성합니다.
$ sudo certbot certonly --standalone --agree-tos --no-eff-email --staple-ocsp --preferred-challenges http -m -d redmine.example.com
위의 명령은 서버의
/etc/letsencrypt/live/redmine.example.com
디렉토리에 인증서를 다운로드합니다.아파치 서버를 시작합니다.
$ sudo systemctl start httpd
Diffie-Hellman 그룹 인증서를 생성합니다.
$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
Lets Encrypt 자동 갱신을 위한 챌린지 웹루트 디렉터리를 만듭니다.
$ sudo mkdir -p /var/lib/letsencrypt
SSL을 갱신하기 위해 Cron 작업을 생성합니다. 인증서를 확인하고 필요한 경우 갱신하기 위해 매일 실행됩니다. 이를 위해 먼저
/etc/cron.daily/certbot-renew
파일을 생성하고 편집을 위해 엽니다.$ sudo nano /etc/cron.daily/certbot-renew
다음 코드를 붙여넣습니다.
#!/bin/sh certbot renew --cert-name redmine.example.com --webroot -w /var/lib/letsencrypt/ --post-hook "systemctl restart nginx"
Ctrl + X를 누르고 메시지가 표시되면 Y를 입력하여 파일을 저장합니다.
실행 가능하도록 태스크 파일에 대한 권한을 변경하십시오.
$ sudo chmod +x /etc/cron.daily/certbot-renew
9단계 - Nginx를 리버스 프록시로 설치 및 구성
Rocky Linux 8은 Nginx의 네 가지 버전(1.14, 1.16, 1.18 및 1.20)과 함께 제공됩니다.
사용 가능한 모든 Nginx 모듈을 나열합니다.
$ dnf module list nginx Last metadata expiration check: 20:23:20 ago on Mon 03 Jan 2022 12:38:07 PM UTC. Rocky Linux 8 - AppStream Name Stream Profiles Summary nginx 1.14 [d] common [d] nginx webserver nginx 1.16 common [d] nginx webserver nginx 1.18 common [d] nginx webserver nginx 1.20 common [d] nginx webserver Extra Packages for Enterprise Linux Modular 8 - x86_64 Name Stream Profiles Summary nginx mainline common nginx webserver nginx 1.20 common [d] nginx webserver Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
다른 버전을 재설정하고 1.20 버전의 Nginx를 활성화합니다.
$ sudo dnf module reset nginx $ sudo dnf module enable nginx:1.20
Nginx를 설치합니다. Appstream에서 Nginx를 가져와야 하므로
Epel
저장소를 일시적으로 비활성화합니다.$ sudo dnf install nginx --disablerepo=epel-modular
설치를 확인하십시오.
$ nginx -v nginx version: nginx/1.20.0
Nginx와의 충돌을 피하려면 Apache가 수신하는 기본 포트를 변경해야 합니다.
Apache 수신 포트 변경
편집을 위해
/etc/httpd/conf/httpd.conf
파일을 엽니다.$ sudo nano /etc/httpd/conf/httpd.conf
다음과 같이 포트를 80에서 8080으로 변경합니다.
Listen 8080
Ctrl + X를 누르고 메시지가 표시되면 Y를 입력하여 파일을 저장합니다.
아파치를 다시 시작하십시오.
$ sudo systemctl restart httpd
Nginx 구성
편집을 위해
/etc/nginx/conf.d/redmine.conf
파일을 만들고 엽니다.$ sudo nano /etc/nginx/conf.d/redmine.conf
다음 코드를 붙여넣습니다.
# Redirect all non-encrypted to encrypted server { listen 80; server_name redmine.example.com; return 301 https://$host$request_uri; } server { listen 443 ssl http2; server_name redmine.example.com; ssl_certificate /etc/letsencrypt/live/redmine.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/redmine.example.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/redmine.example.com/chain.pem; ssl_session_timeout 5m; ssl_session_cache shared:MozSSL:10m; ssl_session_tickets off; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1; ssl_stapling on; ssl_stapling_verify on; ssl_dhparam /etc/ssl/certs/dhparam.pem; resolver 8.8.8.8; access_log /var/log/nginx/redmine.example.com.access.log main; error_log /var/log/nginx/redmine.example.com.error.log; location / { proxy_pass http://localhost:3000; proxy_redirect off; proxy_buffering off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
완료되면 Ctrl + X를 누르고 프롬프트가 표시되면 Y를 입력하여 파일을 저장합니다.
편집을 위해
/etc/nginx/nginx.conf
파일을 엽니다.$ sudo nano /etc/nginx/nginx.conf
include /etc/nginx/conf.d/*.conf;
줄 앞에 다음 줄을 추가합니다.server_names_hash_bucket_size 64;
Ctrl + X를 누르고 메시지가 표시되면 Y를 입력하여 파일을 저장합니다.
Nginx 구성 파일 구문을 확인합니다.
$ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Nginx 서비스를 시작하여 새 구성을 활성화합니다.
$ sudo systemctl start nginx
Redmine 애플리케이션은
https://redmine.example.com
에서 액세스할 수 있어야 합니다.결론
이것으로 Rocky Linux 8 기반 서버에 Redmine Project Manager를 설치하는 방법을 배운 자습서를 마칩니다. 또한 HTTPS 프로토콜을 사용하여 Nginx를 통해 Redmine 애플리케이션을 제공하는 방법도 배웠습니다. 질문이 있으시면 아래 의견에 게시하십시오.