CentOS6安装redmine

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字段了

转载于:https://www.cnblogs.com/diege/p/3942228.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
【优质项目推荐】 1、项目代码均经过严格本地测试,运行OK,确保功能稳定后才上传平台。可放心下载并立即投入使用,若遇到任何使用问题,随时欢迎私信反馈与沟通,博主会第一时间回复。 2、项目适用于计算机相关专业(如计科、信息安全、数据科学、人工智能、通信、物联网、自动化、电子信息等)的在校学生、专业教师,或企业员工,小白入门等都适用。 3、该项目不仅具有很高的学习借鉴价值,对于初学者来说,也是入门进阶的绝佳选择;当然也可以直接用于 毕设、课设、期末大作业或项目初期立项演示等。 3、开放创新:如果您有一定基础,且热爱探索钻研,可以在此代码基础上二次开发,进行修改、扩展,创造出属于自己的独特应用。 欢迎下载使用优质资源!欢迎借鉴使用,并欢迎学习交流,共同探索编程的无穷魅力! 基于业务逻辑生成特征变量python实现源码+数据集+超详细注释.zip基于业务逻辑生成特征变量python实现源码+数据集+超详细注释.zip基于业务逻辑生成特征变量python实现源码+数据集+超详细注释.zip基于业务逻辑生成特征变量python实现源码+数据集+超详细注释.zip基于业务逻辑生成特征变量python实现源码+数据集+超详细注释.zip基于业务逻辑生成特征变量python实现源码+数据集+超详细注释.zip基于业务逻辑生成特征变量python实现源码+数据集+超详细注释.zip 基于业务逻辑生成特征变量python实现源码+数据集+超详细注释.zip 基于业务逻辑生成特征变量python实现源码+数据集+超详细注释.zip
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值