CentOS 7에서 레드마인 설치하기

CentOS 7에서 레드마인 설치하기

Prerequisites

  • Domain name pointing to your server public IP. In this tutorial we will use
  • Logged in as a user with sudo privileges.

Installation

Creating MySQL database:

mysql -u root -p
CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
EXIT;

download redmine:

sudo yum install curl gpg gcc gcc-c++ make patch autoconf automake bison libffi-devel libtool
sudo yum install readline-devel sqlite-devel zlib-devel openssl-develh readline  glibc-headers glibc-devel
sudo yum install mariadb-devel zlib libyaml-devel bzip2 iconv-devel ImageMagick ImageMagick-devel

Installing Passenger and Nginx:

sudo yum install epel-release yum-utils pygpgme
sudo yum-config-manager --enable epel
sudo yum-config-manager --add-repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
sudo yum install nginx passenger passenger-devel

Creating New System User:

sudo useradd -m -U -r -d /opt/redmine redmine
sudo usermod -a -G redmine nginx
sudo chmod 750 /opt/redmine

Installing Ruby:

sudo su - redmine
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source /opt/redmine/.rvm/scripts/rvm
rvm install 2.5
rvm --default use 2.5

Installing Redmine on CentOS:

curl -L http://www.redmine.org/releases/redmine-4.0.1.tar.gz -o redmine.tar.gz
tar -xvf redmine.tar.gz

Change username and password:

cp /opt/redmine/redmine-4.0.1/config/database.yml.example /opt/redmine/redmine-4.0.1/config/database.yml
vi /opt/redmine/redmine-4.0.1/config/database.yml

root 123456

Installing Ruby dependencies:

cd ~/redmine-4.0.1
gem install bundler --no-rdoc --no-ri

Generate Keys and Migrate the Database:

bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate

Configuring Nginx:

exit
sudo vi /etc/nginx/conf.d/34.85.63.115.conf
passenger_root /usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /opt/redmine/.rvm/gems/default/wrappers/ruby;
passenger_instance_registry_dir /var/run/passenger-instreg;

server {
    listen 80;
    server_name 34.85.63.115;

    root /opt/redmine/redmine-4.0.1/public;

    # log files
    access_log /var/log/nginx/34.85.63.115.access.log;
    error_log /var/log/nginx/34.85.63.115.error.log;

    passenger_enabled on;
    passenger_min_instances 1;

    client_max_body_size 10m;
}
sudo nginx -t
sudo systemctl restart nginx

Configure Nginx with SSL:

sudo vi /etc/nginx/conf.d/34.85.63.115.conf
passenger_root /usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /opt/redmine/.rvm/gems/default/wrappers/ruby;
passenger_instance_registry_dir /var/run/passenger-instreg;

# Redirect HTTP -> HTTPS
server {
    listen 80;
    server_name 34.85.63.115;

    include snippets/letsencrypt.conf;
    return 301 https://34.85.63.115$request_uri;
}

# Redirect WWW -> NON WWW
server {
    listen 443 ssl http2;
    server_name 34.85.63.115;

    ssl_certificate /etc/letsencrypt/live/34.85.63.115/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/34.85.63.115/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/34.85.63.115/chain.pem;
    include snippets/ssl.conf;

    return 301 https://34.85.63.115$request_uri;
}

server {
    listen 443 ssl http2;
    server_name 34.85.63.115;

    root /opt/redmine/redmine-4.0.1/public;

    # SSL parameters
    ssl_certificate /etc/letsencrypt/live/34.85.63.115/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/34.85.63.115/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/34.85.63.115/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    # log files
    access_log /var/log/nginx/34.85.63.115.access.log;
    error_log /var/log/nginx/34.85.63.115.error.log;

    passenger_enabled on;
    passenger_min_instances 1;
    client_max_body_size 10m;
}
sudo nginx -t
sudo systemctl restart nginx

Reference

Scroll to Top