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
總結
以上是生活随笔為你收集整理的CentOS6安装redmine的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Ubuntu 下连接Github
- 下一篇: 经典小游戏--推箱子