Step 1: 升级系统
安装完成 Ubuntu 16.04, 升级系统到最新. 安装 git
sudo apt update
sudo apt -y upgrade
sudo apt -y git
Step 2: 安装 MySQL
sudo apt -y install mysql-server mysql-client
输入数据库管理员密码: root
.
创建 redmine
数据库和用户:
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 章节内容如下:
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/ # 时间会较长
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
#创建数据库:
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
配置语言选择: zh
配置目录权限:
sudo find files log tmp public/plugin_assets -type f -exec chmod -x {} +
Step 5: 测试运行 Redmine
sudo su
cd /opt/redmine
bundle exec rails server webrick -e production
打开浏览器: http://127.0.0.1:3000
使用管理员账号: admin 密码: admin
- 将 webrick 作为守护进程运行:
bundle exec rails server webrick -e production -d
- 关闭 RedMine 服务
sudo kill -9 `cat /opt/redmine/tmp/pids/server.pid`
网友评论