參考來源及修正:CentOS 7安装Redmine

建立資料庫

# mysql -u root -p 
CREATE DATABASE redmine CHARACTER SET utf8; ##這裡不要照官網打utf8mb4,不然設定語言會有問題
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
flush privileges;

安裝開發工具及Ruby 2.6.2

# yum groupinstall -y "Development tools"
# yum -y install zlib-devel curl-devel openssl-devel mariadb-devel
# wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.2.tar.gz
# tar zxvf ruby-2.6.2.tar.gz
# cd ruby-2.6.2/
# ./configure
# make
# make install

設定gem源

# gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
# gem sources -l

安裝bundler源及Redmine依賴

# bundle config mirror.https://rubygems.org https://gems.ruby-china.com
# bundle install --without development test rmagick

安裝Redmine

先到網站目錄下
# wget https://www.redmine.org/releases/redmine-4.0.3.tar.gz
# tar zxvf redmine-4.0.3.tar.gz
# mv redmine-4.0.3/ redmine/
# chown -R nginx:nginx redmine/
# cd redmine/config/
# cp database.yml.example database.yml
# vim database.yml
改成自己資料庫帳密
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8

初始化資料庫

# bundle exec rake generate_secret_token
# RAILS_ENV=production bundle exec rake db:migrate
輸入zh-TW

創建目錄設定權限

# cd ..
# mkdir -p tmp tmp/pdf public/plugin_assets/
# chmod -R 755 files log tmp public/plugin_assets

運行綁定80 port

# bundle exec rails server webrick -e production -p 80 &

最後開啟網頁登入admin/admin

設定開機啟動

# vim /home/redmine.sh
內容
#!/bin/bash
bundle exec rails server webrick -e production -p 80 &
# chmod +x /home/redmine.sh
# vim /etc/rc.d/rc.local
加入
source /home/redmine.sh
# chmod +x /etc/rc.d/rc.local