搭建redmine 项目管理系统
一、系统环境准备
1.安装完成centos 6.5操作系统MINI版
2.更新操作系统至6.7 # yum update
查看版本# cat /etc/redhat-release
3.关闭防火墙
关闭命令# service iptables stop
永久关闭防火墙#chkconfig iptables off
两个命令同时运行,运行完成后查看防火墙关闭状态
# service iptables status
4.关闭SELINUX 更改为SELINUX=disabled
# vim /etc/selinux/config
5.下载redmine需要的软件,ruby,rubygems,redemine,msql更新包
创建tools文件夹# mkdir /tools
进入tools文件# cd /tools
下载相关软件
# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
# wget http://production.cf.rubygems.org/rubygems/rubygems-2.4.5.tgz
# wget http://www.redmine.org/releases/redmine-2.4.0.tar.gz
# wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.6.tar.gz
6.安装redmin所需要的环境
# yum -y install libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
7.安装apache和mysql
# yum install mysql-community-server mysql mysql-devel httpd httpd-devel mysql-server -y
# rpm -ivh epel-release-latest-6.noarch.rpm
# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
8.启动mysql
启动
# service mysqld start
用root账户进入数据库
# mysql -uroot
创建redemine数据库
创建名称为redmine数据库并既定字符集问utf-8格式
mysql> create database redmine character set utf8;
刷新所有表单mysql>flush privileges;
退出数据库mysql> exit
9.安装ruby
进入toos文件# cd /tools
解压ruby-2.1.6.tar.gz 安装包# tar xzvf ruby-2.1.6.tar.gz
进入解压后ruby-2.1.6文件夹# cd ruby-2.1.6
安装ruby-2.1.6软件# ./configure --prefix=/usr/local/ruby
安装ruby-2.1.6软件依赖库# make && make install
10.更改profile文件
编辑profile文件# vim /etc/profile
export PATH=/usr/local/ruby/bin:$PATH 再这行加到文档中export那行后面
标注唯一路径# source /etc/profile
产看ruby版本# ruby -v
11.安装rails
进入tloos文件夹# cd /tools
解压缩rubygems-2.4.5.tgz 安装包# tar xzvf rubygems-2.4.5.tgz
进入解压后rubygems-2.4.5 文件夹# cd rubygems-2.4.5
安装rubygems-2.4.5软件# ruby setup.rb
查看rubygems版本# gem –v
查看gem安装路径# which gem
12. 更换gem源为淘宝的源。默认的官方源因为网络问题速度慢
删除官方源# gem sources --remove https://rubygems.org/
添加淘宝源# gem sources -a https://ruby.taobao.org/
查询gem源记录# gem sources –l
安装rails 4.2版本软件gem install rails -v=4.2
13. 安装redmine 2.4
进入tools文件# cd /tools
创建home和www文件夹,并将www放在home中# mkdir /home/www
解压redmine2.4.0到www文件夹中# tar xzvf redmine-2.4.0.tar.gz -C /home/www/
进入www文件夹中# cd /home/www
将redmine-2.4.0文件夹重命名为redmine # mv redmine-2.4.0/ redmine
进入redmine文集那# cd redmine/
安装redmine所使用的数据库# gem install mysql2
14.配置redmine文件
进入config文件# cd config
复制database.yml.example 文件并重命名为database.yml
# cp database.yml.example database.yml
编辑database.yml 文件# vim database.yml
14.安装redmine运行所需要依赖的软件
进入redmine文件夹# cd /home/www/redmine
安装依赖软件# gem install bundler
验证依赖软件是否缺少# bundle install --without development test rmagick 这个命令执行后会报错,是说你有依赖没有安装。按他的提示把需要的依赖全部安装就行了。基本是gem install开头的那那段。大概有20-30个依赖。耐心装吧。如果你SHELL玩的好,可以写个脚本装。
gem install rake -v ‘11.1.2‘
gem install multi_json -v ‘1.12.0‘
gem install builder -v ‘3.0.0‘
gem install erubis -v ‘2.7.0‘
gem install journey -v ‘1.0.4‘
gem install rack -v ‘1.4.7‘
gem install hike -v ‘1.2.3‘
gem install tilt -v ‘1.4.1‘
gem install mime-types -v ‘1.25.1‘
gem install polyglot -v ‘0.3.5‘
gem install arel -v ‘3.0.3‘
gem install tzinfo -v ‘0.3.49‘
gem install coderay -v ‘1.1.1‘
gem install json -v ‘1.8.3‘
gem install thor -v ‘0.19.1‘
gem install mysql2 -v ‘0.3.21‘
gem install net-ldap -v ‘0.3.1‘
gem install ruby-openid -v ‘2.3.0‘
gem install activesupport -v ‘3.2.15‘
gem install rack-cache -v ‘1.6.1‘
gem install rack-test -v ‘0.6.3‘
gem install rack-ssl -v ‘1.3.4‘
gem install sprockets -v ‘2.2.3‘
gem install treetop -v ‘1.4.15‘
gem install rdoc -v ‘3.12.2‘
gem install rack-openid -v ‘1.4.2‘
gem install activemodel -v ‘3.2.15‘
gem install mail -v ‘2.5.4‘
gem install actionpack -v ‘3.2.15‘
gem install activerecord -v ‘3.2.15‘
gem install activeresource -v ‘3.2.15‘
gem install actionmailer -v ‘3.2.15‘
gem install railties -v ‘3.2.15‘
gem install jquery-rails -v ‘2.0.3‘
gem install rails -v ‘3.2.15‘
15. 为Rails生成cookies秘钥
# rake generate_secret_token
16. 调整文件系统权限
进入redmine文件夹# cd /home/www/redmine/
逐个添加tmp tmp,pdf public,plugin_assets文件夹
# mkdir -p tmp tmp/pdf public/plugin_assets
添加apache写入home和www文件夹的权限# chown -R apache.apache /home/www/
允许root账户对howme和www的文件夹写入读写和执行权限
# chmod -R 755 /home/www/
17.初始化redmine安装的数据库
# rake db:migrate RAILS_ENV=production
# rake redmine:plugins:migrate RAILS_ENV=production
# rake tmp:cache:clear
# rake tmp:sessions:clear
18. 测试redmine是否安装成功
启动redmine程序# ruby /usr/local/ruby/bin/rails server webrick -e production –d
查看centos6.7系统中IP或主机启用的端口号# netstat –tpnl
19.安装 Passenger:
gem install passenger
passenger-install-apache2-module # 此时选择“1”,开始安装并配置
20.“mod_passenger.so”权限(这个文件在上面的编译过程中会出现的):
查看“mod_passenger.so”文件路径:如果提前关闭selinux则不需要运行第21步
ll /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.28/buildout/apache2/mod_passenger.so | awk {‘print $NF‘}
chcon -R -h -t httpd_sys_script_exec_t /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.28/buildout/apache2/mod_passenger.so
21、修改Apache配置:
vim /etc/httpd/conf.d/redmine.conf
LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.28/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.28
PassengerDefaultRuby /usr/local/ruby/bin/ruby
<VirtualHost *:80>
ServerName 10.255.96.53
DocumentRoot /home/www/redmine/public
<Directory /home/www/redmine/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
20.启动Apache
/etc/init.d/httpd restart
21.设置SMTP:
cd /home/www/redmine/config
cp configuration.yml.example configuration.yml
vim configuration.yml
default:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: xxx.xxxx.xxx
port: 25
domain: xxxx.xxx
authentication: :login
user_name: "redmine"
password: "XXXXXXXXXXXXXXX"
22.安装插件:
1、 Redmine DMSF 插件(使用 DMSF 1.4.6):
yum install -y libuuid-devel e2fsprogs-devel
cd /home/www/redmine/plugins/
wget https://github.com/danmunn/redmine_dmsf/archive/1.4.6.tar.gz -O redmine_dmsf.tar.gz
tar zxf redmine_dmsf.tar.gz
mv redmine_dmsf-1.4.6 redmine_dmsf
cd /home/www/redmine/plugins/redmine_dmsf
vim Gemfile
source ‘https://ruby.taobao.org‘
bundle install --without xapain development test
chown -R apache:apache /home/www
rake redmine:plugins:migrate RAILS_ENV="production"
rm -rf ../redmine_dmsf.tar.gz
2、Redmine knowledgebase 插件(使用 Knowledgebase 3.0.7 ):
cd /home/www/redmine/plugins
wget https://github.com/alexbevi/redmine_knowledgebase/archive/v3.0.7.tar.gz -O redmine_knowledgebase.tar.gz
tar zxf redmine_knowledgebase.tar.gz
mv redmine_knowledgebase-3.0.7 redmine_knowledgebase
chown -R apache:apache /home/www
cd /home/www/redmine/plugins/redmine_knowledgebase
vim Gemfile
source ‘https://ruby.taobao.org‘
bundle install --without development test
rake db:migrate_plugins RAILS_ENV=production
rm -rf ../redmine_knowledgebase.tar.gz
3、Ckeditor 插件(使用 Ckeditor 1.0.20):
yum install -y ImageMagick
gem install sass-rails
cd /home/www/redmine/plugins
wget https://github.com/a-ono/redmine_ckeditor/archive/1.0.20.tar.gz -O redmine_ckeditor.tar.gz
tar zxf redmine_ckeditor.tar.gz
mv redmine_ckeditor-1.0.20 redmine_ckeditor
chown -R apache:apache /home/www
cd /home/www/redmine/plugins/redmine_ckeditor
vim Gemfile
source ‘https://ruby.taobao.org‘
bundle install --without development test
rake db:migrate_plugins RAILS_ENV=production
rm -rf ../redmine_ckeditor.tar.gz
CKEditor 配置:
1、管理 ----> 插件 ----> Redmine CKEditor plugin
2、配置:
Skin : kama
Enter mode :br
Startup show blocks : 取消选择
启用插件:
1、 管理 ----> 配置
2、配置:
文本格式 : CKEditor
4、Issue templates 插件(使用 Issue templates 0.0.6):
下载:
地址:https://bitbucket.org/akiko_pusu/redmine_issue_templates/downloads
版本:0.0.6
cd /home/www/redmine/plugins/
unzip redmine_issue_templates-0.0.6.zip
mv akiko_pusu-redmine_issue_templates-a937d537f44d redmine_issue_templates
cd redmine_issue_templates
bundle install --without development test
rake redmine:plugins:migrate RAILS_ENV=production
chown -R apache:apache /home/www
启用插件:
1、进入需要配置的项目 ----> 配置 ----> 模块
2、配置:
勾选 -- 问题模板
21.用账户:admin 密码:admin登陆http://10.255.96.53 选择-管理-ldap认证
22.登陆http://10.255.96.53输入域账户如:jiyanjun输入邮箱密码:xxxxx 自动识别ldap用户并保存相应账户至redmine账户数据库