Step 1: 升級(jí)系統(tǒng)
安裝完成 Ubuntu 16.04, 升級(jí)系統(tǒng)到最新. 安裝 git
sudo apt update
sudo apt -y upgrade
sudo apt -y git
Step 2: 安裝 MySQL
sudo apt -y install mysql-server mysql-client
輸入數(shù)據(jù)庫(kù)管理員密碼: root
.
創(chuàng)建 redmine
數(shù)據(jù)庫(kù)和用戶:
CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;
Step 3: 安裝 RedMine
從 Github 下載最新的源碼
cd /opt
sudo git clone https://github.com/redmine/redmine
修改配置文件: database.yml
cd /opt/redmine/config
sudo cp database.yml.example database.yml
修改 production 章節(jié)內(nèi)容如下:
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "redmine"
encoding: utf8mb4
Step 4: 安裝配置 Ruby 及依賴
sudo apt -y install ruby ruby-dev rubygems libmysqlclient-dev imagemagick libmagickwand-dev
修改 Ruby
源, 更新 Ruby
到最新
#export http_proxy=http://127.0.0.1:1080
#export https_proxy=https://127.0.0.1:1080
sudo gem sources --remove https://rubygems.org/ #此處可能需要 Proxy
sudo gem sources --add https://gems.ruby-china.com/ # 時(shí)間會(huì)較長(zhǎng)
gem sources -l # 查看是否只有 gems.ruby-china.com 源
sudo gem update --system
gem -v
Step 5: 安裝配置 Redmine
sudo su
cd /opt/redmine
gem install bundler -V
bundle config mirror.https://rubygems.org https://gems.ruby-china.com
bundle install --without development test
#生成加密:
bundle exec rake generate_secret_token
#創(chuàng)建數(shù)據(jù)庫(kù):
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
配置語(yǔ)言選擇: zh
配置目錄權(quán)限:
sudo find files log tmp public/plugin_assets -type f -exec chmod -x {} +
Step 5: 測(cè)試運(yùn)行 Redmine
sudo su
cd /opt/redmine
bundle exec rails server webrick -e production
打開瀏覽器: http://127.0.0.1:3000
使用管理員賬號(hào): admin 密碼: admin
- 將 webrick 作為守護(hù)進(jìn)程運(yùn)行:
bundle exec rails server webrick -e production -d
- 關(guān)閉 RedMine 服務(wù)
sudo kill -9 `cat /opt/redmine/tmp/pids/server.pid`