Author: Jin
Date: 20140827
System: CentOS release 6.5 (Final)

参考:
http://www.redmine.org/projects/redmine/wiki/Install_Redmine_25x_on_Centos_65_complete
http://www.redmine.org/projects/redmine/wiki/Download

一、准备工作
1.update the System
yum update
reboot

2.Install the dependencies packages
yum -y install vim zip unzip libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA

3.Install Apache and MySQL
yum -y install httpd httpd-devel
yum -y install mysql mysql-server mysql-devel
mysql版本替换成5.5,替换后后面找不到库,5.1版本即可。

4.配置mysql
vim etc/my.cnf 50,1 Bot
/usr/bin/mysql_secure_installation

5.Configuring the Firewall
vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
vim /etc/sysconfig/ip6tables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

reboot

6.Install PHP and phpMyAdmin
yum -y install php php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-soap
service httpd restart
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y install phpmyadmin
vim /etc/httpd/conf.d/phpmyadmin.conf
Listen 8080
<VirtualHost *:8080>
ServerName redmine.testoffice.net
ServerAdmin jin@test.net
DocumentRoot /var/www/html
ErrorLog logs/phpmyadmin_error_log

<Directory "/usr/share/phpmyadmin">
Order Deny,Allow
Deny from all
#Allow from 127.0.0.1
Allow from 192.168.1.77
</Directory>

Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

vim /usr/share/phpmyadmin/config.inc.php
$cfg['Servers'][$i]['auth_type'] = 'http';

二、安装Ruby相关软件
1.Install Ruby
curl -L https://get.rvm.io >> ruby-install.sh
curl -L https://get.rvm.io | bash
source /etc/profile.d/rvm.sh
rvm list known
#We choose the stable version [ruby-] 1.9.3 [-p547], and execute the following command :
rvm install 1.9.3
ruby -v

2.Install Rubygems
yum -y install rubygems
#这里安装会安装ruby 1.87 降低版本了,我是安装后再卸载rubygems
gem install passenger
passenger-install-apache2-module

* Checking for Curl development headers with SSL support...
Found: no
Error: Cannot find the `curl-config` command.
缺少什么组件就安装什么组件

Curl的问题解决
wget http://curl.haxx.se/download/curl-7.37.1.tar.gz
tar -zxvf curl-7.37.1.tar.gz && cd curl-7.37.1
./configure --prefix=/usr/local/curl
make && make instal
ll /usr/local/curl/bin/curl-config
ln -s /usr/local/curl/bin/curl-config /usr/local/bin/curl-config
rvm wrapper ruby-1.9.3-p547 --no-prefix --all
passenger-install-apache2-module

3.配置apache
vi /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.49/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.49
PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p547/wrappers/ruby
</IfModule>
/etc/init.d/httpd restart
chkconfig httpd on

三、Create Database for Redmine
create database redmine_db character set utf8;
create user 'redmine_admin'@'localhost' identified by '123.com';
grant all on redmine_db.* to 'redmine_admin'@'localhost';

四、Install Redmine
cd /var/www
wget http://www.redmine.org/releases/redmine-2.5.2.tar.gz
tar -zxvf redmine-2.5.2.tar.gz
mv redmine-2.5.2 redmine
cd /var/www/redmine/config
cp database.yml.example database.yml
vim database.yml
production:
adapter: mysql2
database: redmine_db
host: localhost
username: redmine_admin
password: "123.com"
encoding: utf8

五、Setting up Rails
cd /var/www/redmine
gem install bundler
bundle install
#这里要坚持安装很多模块
rake generate_secret_token
创建数据
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

六、Activate FCGI
cd /var/www/redmine/public
mkdir plugin_assets
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess

七、Setting up Apache and FastCGI
yum -y install mod_fcgid

八、Creating Files Directory
创建存放图片的目录
mkdir -p /data/redmine/files
chown -R apache.apache /data/redmine/
cd /var/www/redmine/config
cp configuration.yml.example configuration.yml
vim configuration.yml
attachments_storage_path:/data/redmine/files

九、Configuring Email
配置通知邮箱
vim /var/www/redmine/config/configuration.yml
default:
# Outgoing emails configuration (see examples above)
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.exmail.qq.com
port: 25
domain: test.net
authentication: :login
user_name: "redmine@test.net"
password: "1234.com

Create Virtual Host for Redmine
Create an Apache configuration file for the Redmine application at the port 80.

然后用管理员登录redmine,在管理→配置→邮件通知,把邮件发件人地址改成你设置的邮件发件人地址

十、添加apapche配置
vim /etc/httpd/conf.d/redmine.conf
<VirtualHost *:80>
ServerName redmine.testoffice.net
ServerAdmin jin@test.net
DocumentRoot /var/www/redmine/public/
ErrorLog logs/redmine_error_log
<Directory "/var/www/redmine/public/">
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
AllowOverride all
</Directory>
</VirtualHost>y>
</VirtualHost>
/etc/init.d/httpd restart
DNS上面加一个A记录指向这个IP

十一、Running Redmine
cd /var/www
chown -R apache:apache redmine
chmod -R 755 redmine
service httpd restart

十二、Install Subversion
整合SVN
mkdir -p /data/repositories/svn
chown -R apache:apache /data/repositories/
chmod 0755 /data/repositories
yum install mod_dav_svn subversion subversion-ruby
软连svn的扩展到perl5
mkdir /usr/lib64/perl5/vendor_perl/Apache
ln -s /var/www/redmine/extra/svn/Redmine.pm /usr/lib64/perl5/vendor_perl/Apache/Redmine.pm
vim /etc/httpd/conf.d/subversion.conf
PerlLoadModule Apache::Redmine
<Location /svn>
DAV svn
SVNParentPath "/data/repositories/svn"
SVNListParentPath on
Order deny,allow
Deny from all
Satisfy any
LimitXMLRequestBody 0
SVNPathAuthz off
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
AuthType Basic
AuthName "Subversion Repository"
Require valid-user
RedmineDSN "DBI:mysql:database=redmine_db;host=localhost:3306"
RedmineDbUser "redmine_admin"
RedmineDbPass "your_password_database_redmine"
</Location>
可以先将svn配置好再整合
1.配置
<Location /repos>
DAV svn
SVNParentPath /data/repositories/svn
<LimitExcept GET PROPFIND OPTIONS REPORT>
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/httpd/conf/svnpassword
Require valid-user
</LimitExcept>
</Location>
2.用户
htpasswd -cm /etc/httpd/conf/svnpassword jin
3.创建一个
cd /data/repositories/svn
svnadmin create stuff
chown -R apache.apache stuff
4.访问测试
http://192.168.1.222/repos/stuff/
http://tortoisesvn.net/downloads.html
5.加入整合配置
测试报错
# /etc/init.d/httpd configtest
Syntax error on line 56 of /etc/httpd/conf.d/subversion.conf:
Invalid command 'PerlLoadModule', perhaps misspelled or defined by a module not included in the server configuration

使用其他方式整合

十二、SVN 使用redmine账号
1.安装mod_auth_mysql模块
yum -y install mod_auth_mysql
配置参考
/etc/httpd/conf.d/auth_mysql.conf

2.配置访问
<Location /repos>
DAV svn
SVNParentPath /data/repositories/svn
AuthName Subversion
AuthType Basic

AuthMYSQLEnable on
AuthMySQLHost localhost
AuthMySQLUser redmine_admin
AuthMySQLPassword 123.com
AuthMySQLDB redmine_db
AuthMySQLPwEncryption sha1

#AuthMySQLUserTable test_users
#AuthMySQLNameField user_name
#AuthMySQLPasswordField user_passwd
#AuthMySQLGroupField user_group

AuthMySQLUserTable svn_user
AuthMySQLNameField user_name
AuthMySQLPasswordField user_passwd
AuthMySQLGroupTable svn_group
AuthMySQLGroupField user_group

require valid-user
</Location>
<Location ~ "/repos/(stuff|opt)">
<Limit GET PROPFIND OPTIONS REPORT>
Require user jin
</Limit>
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require group opt_admin
</LimitExcept>
</Location>

3.在redmine数据库组创建两张视图组合我们需要的数据
create view svn_user as
SELECT users.login as user_name,users.hashed_password as user_passwd FROM users
WHERE users.status =1 and users.type='User'

create view svn_group as
select DISTINCT users.login as user_name,concat(projects.identifier,"_",roles.name) as user_group from
users,roles,projects,members,member_roles where
users.status=1 and
users.type = 'User' and
users.id=members.user_id and
members.id= member_roles.member_id and
projects.id =members.project_id

[root@omg-release conf.d]# /etc/init.d/httpd configtest
Syntax OK
[root@omg-release conf.d]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

http://liwangmj.com/668.html

无法访问,验证下来初步判断数据库里存放的密码加密的方式的问题
不仅仅是AuthMySQLPwEncryption sha1,密码还加了salt
select sha1('password')和数据库保持不一样
({salt}.sha1({密码}))
http://www.redmine.org/projects/redmine/wiki/FAQ/
官方论坛找到两种解决方案
http://www.redmine.org/boards/2/topics/24386
1) Patch mod_auth_mysql to apply salt in the same manner as redmine.
因为已经有账号,所以我选择第一种
mod_auth_mysql-3.0.0-redmine.patch
http://www.redmine.org/attachments/download/6443/mod_auth_mysql-3.0.0-redmine.patch
http://www.redmine.org/attachments/download/6172/mod_auth_mysql.patch
http://heanet.dl.sourceforge.net/sourceforge/modauthmysql/mod_auth_mysql-3.0.0.tar.gz
步骤
yum remove mod_auth_mysql
wget http://www.redmine.org/attachments/download/6443/mod_auth_mysql-3.0.0-redmine.patch
wget http://heanet.dl.sourceforge.net/sourceforge/modauthmysql/mod_auth_mysql-3.0.0.tar.gz
tar -zxvf mod_auth_mysql-3.0.0.tar.gz
#patch -p0 < mod_auth_mysql-3.0.0-redmine.patch
patching file mod_auth_mysql-3.0.0/mod_auth_mysql.c
#cd mod_auth_mysql-3.0.0
编译安装
cat BUILD
apxs -c -L/usr/lib/mysql -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c
apxs -i mod_auth_mysql.la
这个patch只能用在5上面
另外一个试试
cp mod_auth_mysql.patch mod_auth_mysql-3.0.0
也不行

2) Patch redmine to store “unsalted” hashed passwords alongside the currently salted ones.
第二种方案,去改redmine密码加密的方式
line 245
User.hash_password(“#{salt}#{User.hash_password clear_password}”) == hashed_password
change to
User.hash_password(clear_password) == hashed_password

line 254
self.hashed_password = User.hash_password(“#{salt}#{User.hash_password clear_password}”)
change to
self.hashed_password = User.hash_password(clear_password)

line 592
hashed_password = User.hash_password(“#{salt}#{user.hashed_password}”)
change to
hashed_password = user.hashed_password

这样mod_auth_mysql就能直接通过sha1加密匹配hashed_passsword字段了

还有一种解决方案
It's time to kick mod_auth_mysql off, use redmine-auth insteaded.
see https://github.com/laiyonghao/redmine-auth

十三、使用nginx
http://www.92csz.com/51/825.html
配置mongrel_cluster
cd /data/www/redmine
mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 3
启用mongrel_cluster
cd /data/www/redmine
mongrel_rails cluster::start

vi /data/soft/nginx/conf/nginx.conf
upstream mongrel
{
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}
server
{
listen 80;
server_name 192.168.8.32;
root /data/www/redmine;
index index.html index.htm;
location /
{
proxy_pass http://mongrel;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

十四、迁移redmine
windows迁移到linux
1.准备linux环境
2.导入数据库
3.导入图片
如果要修改密码保存方式,需要一下
1.转换原来有的密码
Found in file /app/models/user.rb: 'The hashed password is stored in the following form: SHA1\(salt + SHA1)'
So you can reset password in two steps:
- clear salt
- calculate sha1(sha1(new_password))
For example for the password "password" (without quote) it will be "353e8061f2befecb6818ba0c034c632fb0bcae1b"
sah1(password)=0bd181063899c9239016320b50d3e896693a96df
sha1(0bd181063899c9239016320b50d3e896693a96df)=353e8061f2befecb6818ba0c034c632fb0bcae1b

You have to go to redmine database, find "users" table, find user to reset password, clear "salt" field's user and put "353e8061f2befecb6818ba0c034c632fb0bcae1b" in "hashed_password" field's user and log to redmine with new password 'password' (without quote). To do this redmine database changes, do the following from command line in the operating system where Redmine is working:
note user and password from a file config/database.yml.
For MySQL
execute command: mysql -u <db user from database.yml> -p
enter: <password from database.yml>
execute: UPDATE users SET hashed_password='353e8061f2befecb6818ba0c034c632fb0bcae1b' WHERE login='admin';
execute: UPDATE users SET salt='' WHERE login='admin';
execute: exit

2.修改代码不加salt
# grep -r -n User.hash_password /var/www/redmine
/var/www/redmine/app/models/user.rb:273: User.hash_password("#{salt}#{User.hash_password clear_password}") == hashed_password
/var/www/redmine/app/models/user.rb:281: self.hashed_password = User.hash_password("#{salt}#{User.hash_password clear_password}")
/var/www/redmine/app/models/user.rb:655: hashed_password = User.hash_password("#{salt}#{user.hashed_password}")
/var/www/redmine/test/unit/user_test.rb:1109: user.hashed_password = User.hash_password("unsalted")

line 245
User.hash_password(“#{salt}#{User.hash_password clear_password}”) == hashed_password
change to
User.hash_password(clear_password) == hashed_password

line 254
self.hashed_password = User.hash_password(“#{salt}#{User.hash_password clear_password}”)
change to
self.hashed_password = User.hash_password(clear_password)

line 592
hashed_password = User.hash_password(“#{salt}#{user.hashed_password}”)
change to
hashed_password = user.hashed_password

这样mod_auth_mysql就能直接通过sha1加密匹配hashed_passsword字段了

CentOS6安装redmine的更多相关文章

  1. Centos5.8 安装 Redmine

    安装Ruby 到 /opt/ruby-2.0.0 -p481.tar.gz cd ruby--p481 ./configure --prefix=/opt/ruby- sudo make sudo m ...

  2. Linux上安装Redmine

    安装基本的软件环境 # yum install zip unzip libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr- ...

  3. Centos6.5+Redmine

    花了两天时间,基于centos6.5操作系统,搭建了redmine环境,在这里记录下过程中遇到的问题以及搭建流程. centos6.5; redmine2.5.0; Ruby1.9.3; step 1 ...

  4. CentOS 6.6 安装redmine

    Redmine是一个开源的.基于Web的项目管理和缺陷跟踪工具.它用日历和甘特图辅助项目及进度可视化显示.同时它又支持多项目管理.Redmine是一个自由开放源码软件解决方案,它提供集成的项目管理功能 ...

  5. BitNami一键安装Redmine(转)

    1. 简介 对于一个新手,如果严格按照官方文档来安装redmine,我想会“疯”掉的.有没有一种简便的方法.有滴,那就是BitNami. BitNami提供redmine的一键安装程序,简单.易用.方 ...

  6. CentOS下安装Redmine 2.5.2

    Redmine是用Ruby开发的基于web的项目管理软件,所以先要下载安装Ruby,再下载对 Ruby组件进行打包的 Ruby 打包系统RubyGems. 第一步:下载必要的软件 1.依赖包安装 # ...

  7. Centos6 安装vnc

    Centos6 安装vnc 1. 安装 使用yum方式安装 yum install tigervnc-server tigervnc #启动 vncserver #重启动 /etc/init.d/vn ...

  8. centos6 安装vsftpd

    centos6 安装vsftpd vsftpd一般选择yum安装,以下是安装和配置过程 如果是centos6想要安装的话一般是编译安装 1.安装 yum安装 yum install vsftpd 编译 ...

  9. BitNami一键安装Redmine

    1. 简单介绍 对于一个新手,假设严格依照官方文档来安装redmine,我想会"疯"掉的.有没有一种简便的方法.有滴,那就是BitNami. BitNami提供redmine的一键 ...

随机推荐

  1. MongoDB的安装与使用

    MongoDB是一款NoSql数据库.NoSql数据库叫非关系型数据库,NoSql的全名Not only sql.是为了解决高并发.高可用.高可扩展,以及大数据存储等一系列问题而产生的数据库解决方案. ...

  2. dpr 与 dproj 有什么区别

  3. 四B象限图

  4. 使用jsplumb的一些笔记

    欢迎就是需要使用jsplumb跟正在使用jsplumb的一起讨论 欢迎私聊 1.关于jsplumb的connection的一些事件 ####connection拖动的事件 instance.bind( ...

  5. qt 问题及处理

    1. 包依赖问题 在windows平台时,通过microsoft process Explorer可以查看所以来的dll.并将这些dll复制到应用程序目录,加上qt.conf就可以使用了. [Path ...

  6. Elasticsearch: 权威指南---基础入门

    1.查看方式:GETURL:http://10.10.6.225:9200/?pretty pretty 在任意的查询字符串中增加pretty参数.会让Elasticsearch美化输出JSON结果以 ...

  7. gym 100531 三维几何+搜索

    精度有点毒, 其实可以不用double, 因为A, B必定在其中一个在三角形上,可以投影到只有x,y轴的地方叉积比较. #include<bits/stdc++.h> #define LL ...

  8. HBase结合MapReduce批量导入(HDFS中的数据导入到HBase)

    HBase结合MapReduce批量导入 package hbase; import java.text.SimpleDateFormat; import java.util.Date; import ...

  9. 7-10 守卫棋盘 uva11214

    输入要给n*m的棋盘  均小于10   某些格子有标记  用最少的皇后  辐射到所有的标记 限时 6666ms 用IDA*    时间6000  尴尬. #include<bits/stdc++ ...

  10. shell rename directory

    mv can do two jobs. It can move files or directories It can rename files or directories To just rena ...