建立Redmine环境

准备在Fedora20虚拟机上建立一个redmine+git的协作站点,主要是想看看怎么建立起来的。

  • 安装ruby开发环境
  • 安装mysql
  • 安装appace
  • 安装redmine
  • 配置git

安装ruby

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ sudo yum install -y gcc gcc-c++ make apr-devel apr-util-devel \
zlib-devel curl-devel expat-devel gettext-devel \
openssl-devel httpd httpd-devel mysql mysql-server \
mysql-devel libxml2-devel libxslt-devel ImageMagick-devel
$ sudo yum install -y ruby gem ruby-devel
$ ruby --version
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
$ gem -v
2.1.11
$ gem source -l
https://rubygems.org/
$ gem source --remove https://rubygems.org/
https://rubygems.org/ removed from sources
$ gem source -a http://ruby.taobao.org/
http://ruby.taobao.org/ added to sources
$ gem source -l
http://ruby.taobao.org/
$ gem install rdoc rdoc-data
$ gem install rails

安装mysql

系统已经安装好了,如果要安装,也就是命令sudo yum install -y mysql等。

启动mysql:

1
2
3
$ chown -R mysql:mysql /var/lib/mysql/
$ systemctl start mysqld.service

安装redmine

文档:http://www.redmine.org/projects/redmine/wiki/RedmineInstall

获取源码包

1
2
3
4
5
6
7
8
9
10
11
12
13
$ wget https://github.com/redmine/redmine/archive/2.5.0.tar.gz
$ tar -xzvf 2.5.0.tar.gz
$ mv redmine-2.5.0 /usr/local/bin/
$ cd /usr/local/bin/redmine-2.5.0/
$ sed -i "s/https/http/g;s/rubygems/ruby.taobao/g" Gemfile
$ cp config/configuration.yml.example config/configuration.yml
$ cp config/database.yml.example config/database.yml

configure production

Copy config/database.yml.example to config/database.yml and edit.

1
2
3
4
5
6
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: my_password

创建MySQL数据库

1
2
3
4
5
$ mysql
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

安装依赖ruby软件包

1
2
$ gem install bundler
$ bundle install --without development test

生成密码

1
$ rake generate_secret_token

创建数据库模式

1
RAILS_ENV=production rake db:migrate

默认数据库设置

1
RAILS_ENV=production rake redmine:load_default_data

更新文件系统权限

1
2
3
mkdir -p tmp tmp/pdf public/plugin_assets
sudo chown -R redmine:redmine files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets

测试安装效果

1
2
3
$ ruby script/rails server webrick -e production
http://0.0.0.0:3000

登陆

默认登陆是admin/admin,然后作为管理员进行一些配置。

参考资料

吴羽舒 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!