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字段了
CentOS6安装redmine的更多相关文章
- Centos5.8 安装 Redmine
安装Ruby 到 /opt/ruby-2.0.0 -p481.tar.gz cd ruby--p481 ./configure --prefix=/opt/ruby- sudo make sudo m ...
- Linux上安装Redmine
安装基本的软件环境 # yum install zip unzip libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr- ...
- Centos6.5+Redmine
花了两天时间,基于centos6.5操作系统,搭建了redmine环境,在这里记录下过程中遇到的问题以及搭建流程. centos6.5; redmine2.5.0; Ruby1.9.3; step 1 ...
- CentOS 6.6 安装redmine
Redmine是一个开源的.基于Web的项目管理和缺陷跟踪工具.它用日历和甘特图辅助项目及进度可视化显示.同时它又支持多项目管理.Redmine是一个自由开放源码软件解决方案,它提供集成的项目管理功能 ...
- BitNami一键安装Redmine(转)
1. 简介 对于一个新手,如果严格按照官方文档来安装redmine,我想会“疯”掉的.有没有一种简便的方法.有滴,那就是BitNami. BitNami提供redmine的一键安装程序,简单.易用.方 ...
- CentOS下安装Redmine 2.5.2
Redmine是用Ruby开发的基于web的项目管理软件,所以先要下载安装Ruby,再下载对 Ruby组件进行打包的 Ruby 打包系统RubyGems. 第一步:下载必要的软件 1.依赖包安装 # ...
- Centos6 安装vnc
Centos6 安装vnc 1. 安装 使用yum方式安装 yum install tigervnc-server tigervnc #启动 vncserver #重启动 /etc/init.d/vn ...
- centos6 安装vsftpd
centos6 安装vsftpd vsftpd一般选择yum安装,以下是安装和配置过程 如果是centos6想要安装的话一般是编译安装 1.安装 yum安装 yum install vsftpd 编译 ...
- BitNami一键安装Redmine
1. 简单介绍 对于一个新手,假设严格依照官方文档来安装redmine,我想会"疯"掉的.有没有一种简便的方法.有滴,那就是BitNami. BitNami提供redmine的一键 ...
随机推荐
- python dict交换key value值
方法一: 使用dict.items()方式 dict_ori = {'A':1, 'B':2, 'C':3} dict_new = {value:key for key,value in dict_o ...
- HDU 3068 最长回文(manacher模板题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3068 题目大意:求字符串s中最长的回文子串 解题思路:manacher模板 代码 #include&l ...
- 一键开关VS的release模式优化
因为我们公司的项目规模非常大了,如果日常调试使用debug模式的话,每次调试启动都要非常长的时间,因此大多数人使用release关优化的方式来进行日常开发.但是因为持续集成的存在,上传的代码要求是开启 ...
- MySQL学习笔记:从一个表update到另外一个表
# ---- 测试数据 ---- # 表1 CREATE TABLE temp_x AS AS c_id, 1.11 AS c_amount FROM DUAL UNION ALL AS c_id, ...
- cve-2010-3333 Microsoft Office Open XML文件格式转换器栈缓冲区溢出漏洞 分析
用的是泉哥的POC来调的这个漏洞 0x0 漏洞调试 Microsoft Office Open XML文件格式转换器栈缓冲区溢出漏洞 Microsoft Office 是微软发布的非常流行的办公 ...
- 使用EasyWechat快速开发微信公众号支付
前期准备: 申请微信支付后, 会收到2个参数, 商户id,和商户key.注意,这2个参数,不要和微信的参数混淆.微信参数: appid, appkey, token支付参数: merchant_id( ...
- 【洛谷】P2179 [NOI2012]骑行川藏
题解 感谢小迪给我讲题啊,这题小迪写挺好的我就不写了吧 小迪的题解 代码 #include <iostream> #include <cstdio> #include < ...
- codeforces 354 D. Transferring Pyramid
D. Transferring Pyramid time limit per test 3 seconds memory limit per test 256 megabytes input stan ...
- Java学习笔记之:Spring MVC 环境搭建
一.创建项目 1.新建java动态项目 2.在web-inf/lib文件夹下导入jar 3.创建所需要的包和文件 二.搭建SpringMVC 1.配置web.xml(WEB-INF下) <?xm ...
- 本机ip和127.0.0.1的区别
简介 连接上因特网的每一台计算机都会有一个IP地址, 在linux下可以使用命令ifconfig来查看本机的ip地址(windows为ipconfig), 比如我当前电脑的ip地址为192.168.0 ...