Install redmine on centos6

Source: Internet
Author: User
Tags ldap sha1 encryption redmine

Author: Jin
Data: 20140827
System: centos release 6.5 (final)

Refer:
Http://www.redmine.org/projects/redmine/wiki/Install_Redmine_25x_on_Centos_65_complete
Http://www.redmine.org/projects/redmine/wiki/Download

I. Preparations
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-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-devel
Yum-y install MySQL mysql-server mysql-devel
Replace the mysql version with 5.5. After the replacement, the database cannot be found. Replace the mysql version with 5.1.

4. Configure MySQL
Vim ETC/My. CNF 50,1 Bot
/Usr/bin/mysql_secure_installation

5. refreshing 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-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 [email protected]
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 ';

2. Install ruby-related software
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
# Here, Ruby 1.87 is installed and downgraded. After installation, uninstall 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.
Install components if they are missing

Curl Solution
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. Configure 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


3. Create Database for redmine
Create Database redmine_db Character Set utf8;
Create user 'redmine _ admin' @ 'localhost' identified by '2017. com ';
Grant all on redmine_db. * To 'redmine _ admin' @ 'localhost ';

Iv. 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
Music 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

5. Setting up rails
CD/var/www/redmine
Gem install bundler
Bundle install
# Install many modules
Rake generate_secret_token
Create data
Rails_env = production rake DB: migrate
Rails_env = production rake redmine: load_default_data

6. Activate fcgi
CD/var/www/redmine/Public
Mkdir plugin_assets
CP dispatch. fcgi. Example dispatch. fcgi
CP htaccess. fcgi. example. htaccess

VII. Setting up Apache and FastCGI
Yum-y install mod_fcgid

VIII. Creating files directory
Create a directory for storing images
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

IX. Receiving Email
Configure Notification Email
Vim/var/www/redmine/config/configuration. yml
Default:
# Outgoing emails configuration (see examples abve)
Email_delivery:
Delivery_method: SMTP
Smtp_settings:
Address: smtp.exmail.qq.com
Port: 25
Domain: test.net
Authentication: Login
User_name: "[email protected]"
Password: "1234.com

Create virtual host for redmine
Create an Apache configuration file for the redmine application at the port 80.


Then log on to redmine as an administrator, choose manage> Configure> email notification, and change the email sender address to the email sender address you set.


10. Add apapche Configuration
Vim/etc/httpd/CONF. d/redmine. conf
<Virtualhost *: 80>
Servername redmine.testoffice.net
Serveradmin [email protected]
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
Add a record to the DNS to point to this IP address.

11. Running redmine
CD/var/WWW
Chown-r Apache: Apache redmine
Chmod-r 755 redmine
Service httpd restart


12. Install Subversion
Integrate SVN
Mkdir-P/data/repositories/SVN
Chown-r Apache: Apache/data/repositories/
Chmod 0755/data/Repositories
Yum install mod_dav_svn subversion-Ruby
Extend soft connection SVN to 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>
You can configure SVN before integration.
1. Configuration
<Location/repos>
Dav SVN
Svnparentpath/data/repositories/SVN
<Limitaskt get PROPFIND Options Report>
Authtype basic
Authname "Authorization realm"
Authuserfile/etc/httpd/CONF/svnpassword
Require valid-user
</Limit10000t>
</Location>
2. User
Htpasswd-CM/etc/httpd/CONF/svnpassword Jin
3. Create
CD/data/repositories/SVN
Svnadmin create stuff
Chown-r Apache. Apache stuff
4. Access Test
Http: // 192.168.1.222/repos/stuff/
Http://tortoisesvn.net/downloads.html
5. Add integrated configuration
Test Error
#/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 supported in the server configuration

Other Integration Methods


12. SVN uses the redmine account
1. Install the mod_auth_mysql Module
Yum-y install mod_auth_mysql
Configuration reference
/Etc/httpd/CONF. d/auth_mysql.conf

2. configure access
<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>
<Limitaskt get PROPFIND Options Report>
Require group opt_admin
</Limit10000t>
</Location>

3. Create two views in the redmine database group to combine the data we need
Create view svn_user
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
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


[[Email protected] Conf. d] #/etc/init. d/httpd configtest
Syntax OK
[[Email protected] Conf. d] #/etc/init. d/httpd restart
Stopping httpd: [OK]
Starting httpd: [OK]

Http://liwangmj.com/668.html

Unable to access, verify and preliminarily determine the password encryption method stored in the database
Not only authmysqlpwencryption sha1, but also salt
Select sha1 ('Password') is different from the database
({Salt}. sha1 ({password }))
Http://www.redmine.org/projects/redmine/wiki/FAQ/
Two solutions are available on the official forum.
Http://www.redmine.org/boards/2/topics/24386
1) patch mod_auth_mysql to apply salt in the same manner as redmine.
Because I already have an account, I chose the first one.
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
Procedure
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
Compile and install
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
This patch can only be used on 5
Try another one
CP mod_auth_mysql.patch mod_auth_mysql-3.0.0
No.


2) patch redmine to store "unsalted" hashed passwords alongside the currently salted ones.
Solution 2: Change the redmine password encryption method
Line 245
User. hash_password ("# {salt} # {user. hash_password clear_password}") = hashed_password
Change
User. hash_password (clear_password) = hashed_password

Line 254
Self. hashed_password = user. hash_password ("# {salt }#{ user. hash_password clear_password }")
Change
Self. hashed_password = user. hash_password (clear_password)

Line 592
Hashed_password = user. hash_password ("# {salt} # {user. hashed_password }")
Change
Hashed_password = user. hashed_password

In this way, mod_auth_mysql can directly match the hashed_passsword field through sha1 encryption.

There is also a solution
It's time to kick mod_auth_mysql off, use redmine-auth insteaded.
See https://github.com/laiyonghao/redmine-auth

 

 

XIII. Use nginx
Http://www.92csz.com/51/825.html
Configure mongrel_cluster
CD/data/www/redmine
Mongrel_rails cluster: Configure-e production-P 8000-A 127.0.0.1-N 3
Enable 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;
}
}


14. redmine migration
Migrate from windows to Linux
1. Prepare the Linux environment
2. Import the database
3. Import images
If you want to change the password storage method, you need
1. Convert the original password
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 "%e8061f2befecb6818ba0c034c632fb0bcae1b"
Sah1 (password) = 0bd184153899c9239016320b50d3e896693a96df
Sha1 (0bd184253899c9239016320b50d3e896693a96df) = %e8061f2befecb6818ba0c034c632fb0bcae1b

You have to go to redmine database, find "users" table, find user to Reset Password, clear "salt" field's user and put "inclue8061f2befecb6818ba0c034c632fb0bcae1b" 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 = '2017e8061f2befecb6818ba0c034c632fb0bcae1b 'where login = 'admin ';
Execute: Update users set salt = ''where login = 'admin ';
Execute: Exit

2. modify the code without adding 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
User. hash_password (clear_password) = hashed_password

Line 254
Self. hashed_password = user. hash_password ("# {salt }#{ user. hash_password clear_password }")
Change
Self. hashed_password = user. hash_password (clear_password)

Line 592
Hashed_password = user. hash_password ("# {salt} # {user. hashed_password }")
Change
Hashed_password = user. hashed_password

In this way, mod_auth_mysql can directly match the hashed_passsword field through sha1 encryption.

Install redmine on centos6

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.