原文地址:http://112.74.112.215/projects/james/wiki/本站redmine的搭建过程
阿里云创建和管理虚拟机过程见官方文档不详细介绍。
主要记录系统安装过程及问题的处理。
重新安装,部署,作为生产环境。
本地虚拟机作为开发环境。redmine做为网站主站,进行项目管理。
L linux ubuntu 1404LTS
sudo apt-get update sudo apt-get upgrade sudo apt-get install openssh-server
N nginx
vim /etc/apt/sources.list
add //trusty is for ubuntu1404deb trusty nginx deb-src trusty nginx
When trying to install nginx in debian, you may encounter this error:
W: GPG error: squeeze Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62
The solution is this:
gpg --keyserver keyserver.ubuntu.com --recv-key ABF5BD827BD9BF62 gpg -a --export ABF5BD827BD9BF62 | apt-key add -
Example output:
root@shell:~# gpg --keyserver keyserver.ubuntu.com --recv-key ABF5BD827BD9BF62 gpg: requesting key 7BD9BF62 from hkp server keyserver.ubuntu.com gpg: /root/.gnupg/trustdb.gpg: trustdb created gpg: key 7BD9BF62: public key "nginx signing key <>" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) root@shell:~# gpg -a --export ABF5BD827BD9BF62 | apt-key add -
OK
Then type:
apt-get update apt-get install nginx curl
配置
/etc/nginx/site-available 或者 /etc/nginx/conf.d/
redmine.confupstream redmine { server 127.0.0.1:3000; }
server { server_name 112.74.112.215; root /usr/share/nginx/html/redmine/public;
location / { try_files $uri @redmine; }
location @redmine { proxy_set_header X-Forwarded-For $remote_addr; proxy_pass } }
rvm 安装ruby on rails
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
sudo curl -L | sudo bash -s stable
source ~/.rvm/scripts/rvm rvm -v // 确认版本 rvm install 2.2.3 ruby -v // 确认版本
rvm 2.2.3 --default // 设置默认版本 gem -v // 确认gem 版本 修改 gem source
$ gem sources -r $ gem source -a $ gem source -l // 查看当前的source
gem install rails
// 问题处理
find . -name mkmf.log 查看log文件内容 缺少 -lgmp 安装gmp sudo apt-get install libgmp-dev
rails -v //确认版本
M mariaDB 替换MySQL
sudo apt-get install mariadb-server libmysqlclient-dev
R redmine
sudo apt-get install imagemagick libmagickwand-dev libcurl4-openssl-dev
wget
数据库
CREATE DATABASE redmine CHARACTER SET utf8; CREATE USER 'james''localhost' IDENTIFIED BY '******'; GRANT ALL PRIVILEGES ON redmine.* TO 'james''localhost';
Copy config/database.yml.example to config/database.yml
production: adapter: mysql2 database: redmine host: localhost username: james password: **
安装
gem install bundlervim Gemfile修改source 为:
bundle install --without development test
rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
assuming you run the application with a redmine user account:
mkdir -p tmp tmp/pdf public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets
测试
ruby bin/rails server webrick -e production
正式启动时
ruby bin/rails server webrick -e production &
登录验证 Logging into the application
Use default administrator account to log in:
login: admin password: admin