centos 6.7下安装redmine+svn+apache

分类:CentOS教程 阅读:73901 次

系统环境

cat/etc/redhat-release

CentOSrelease6.7(Final)

uname-r

2.6.32-573.el6.x86_64

1.替换yum源为163。大家都是高手,这里不做详细的交代了。

把这个文件放到/etc/yum.reop下。

yuminstall-yupdate

关闭和清理防火墙和selinux

2.

mkdir/tools

cd/tools

wgethttps://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

wgethttp://production.cf.rubygems.org/rubygems/rubygems-2.4.5.tgz

Wgethttp://www.redmine.org/releases/redmine-3.1.0.tar.gz

wgethttp://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.6.tar.gz

3.安装环境

yum-yinstalllibyaml-develzlib-develcurl-developenssl-develhttpd-develapr-develapr-util-develgccruby-develgcc-c++makepostgresql-develImageMagick-develsqlite-develperl-LDAPmod_perlperl-Digest-SHA

4.安装apache和mysql

yuminstallmysql-community-servermysqlmysql-develhttpdhttpd-develmysql-server-y

rpm-ivhepel-release-latest-6.noarch.rpm

rpm-Uvhhttp://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

5.启动mysql

servicemysqldstart

mysqladmin-uroot-ppasswordP@55w0rd

mysql-uroot-p

mysql>createdatabaseredmine;

mysql>useredmine;

mysql>source/data/redmine.sql

6.安装ruby

cd/tools

tarxzvfruby-2.1.6.tar.gz

cdruby-2.1.6

./configure--prefix=/usr/local/ruby

make&&makeinstall

cd..

vim/etc/profile

exportPATH=/usr/local/ruby/bin:$PATH再这行加到文档中export那行后面

source/etc/profile

ruby-v

#ruby2.1.6p336(2015-04-13revision50298)[x86_64-linux]

7.安装rails

cd/tools

tarxzvfrubygems-2.4.5.tgz

cdrubygems-2.4.5

rubysetup.rb

gem-v

#2.4.5

whichgem

#/usr/local/ruby/bin/gem

更换gem源为淘宝的源。默认的官方源因为网络问题速度慢

gemsources--removehttps://rubygems.org/

gemsources-ahttps://ruby.taobao.org/

gemsources-l最后只能看到一个淘宝的源

geminstallrails-v=4.2

8.安装redmine3.1

cd/tools

mkdir/home/www

tarxzvfredmine-3.1.0.tar.gz-C/home/www/

cd/home/www

mvredmine-3.1.0/redmine

cdredmine/

geminstallmysql2

配置redmine文件

cdconfig

cpdatabase.yml.exampledatabase.yml

vimdatabase.yml

production:

adapter:mysql2

database:redmine

host:localhost

username:root

password:"P@55w0rd"(这里是你登陆redmien数据库的用户名和密码)

encoding:utf8

development:

adapter:mysql2

database:redmine_development

host:localhost

username:root

password:""

encoding:utf8

9.安装依赖

cd/home/www/redmine

geminstallbundler

bundleinstall--withoutdevelopmenttestrmagick这个命令执行后会报错,是说你有依赖没有安装。按他的提示把需要的依赖全部安装就行了。基本是geminstall开头的那那段。大概有20-30个依赖。耐心装吧。如果你SHELL玩的好,可以写个脚本装。

geminstalljson-v'1.8.3'

geminstallrake-v'10.4.2'

geminstallactivesupport-v'4.2.3'

geminstallactionview-v'4.2.3'

geminstallactionpack-v'4.2.3'

geminstallactionmailer-v'4.2.3'

geminstallactionpack-action_caching-v'1.1.1'

geminstallactionpack-xml_parser-v'1.0.2'

geminstallactivemodel-v'4.2.3'

geminstallactiverecord-v'4.2.3'

geminstallcoderay-v'1.1.0'

geminstallrailties-v'4.2.3'

geminstalljquery-rails-v'3.1.3'

geminstallnet-ldap-v'0.3.1'

geminstallprotected_attributes-v'1.1.3'

geminstallruby-openid-v'2.3.0'

geminstallrack-openid-v'1.4.2'

geminstallrails-v'4.2.3'

geminstallrbpdf-v'1.18.6'

geminstallredcarpet-v'3.1.2'

geminstallrequest_store-v'1.0.5'

geminstallmysql2-v'0.3.19'

为Rails生成cookies秘钥

rakegenerate_secret_token

调整文件系统权限

cd/home/www/redmine/

mkdir-ptmptmp/pdfpublic/plugin_assets

chown-Rapache.apache/home/www/

chmod-R755/home/www/

初始化数据库

rakedb:migrateRAILS_ENV=production

rakeredmine:plugins:migrateRAILS_ENV=production

raketmp:cache:clear

raketmp:sessions:clear

测试redmine是否安装成功

ruby/usr/local/ruby/bin/railsserverwebrick-eproduction-d

lsof-itcp:3000检查端口是否开启

10.配置Redmine在Apache上运行

cd/home/www/redmine/public

cpdispatch.fcgi.exampledispatch.fcgi

cphtaccess.fcgi.example.htaccess

chown-Rapache.apache/home/www/redmine/

安装Passenger(用于整合Apache)

geminstallpassenger

passenger-install-apache2-module

11.安装SVN和其他模块。

yuminstall-ysubversion

yum-yinstallelinks

yuminstall-ymod_ssl

yuminstall-ymod_fcgid

yuminstall-ymod_dav_svn

yuminstall-ymod_auth_mysql

mkdir-p/usr/lib64/perl5/vendor_perl/Apache/

cd/home/www/redmine/extra/svn

cpRedmine.pm/usr/lib64/perl5/vendor_perl/Apache\

修改配置文件,安装完成后。你需要对配置进行修改。由于篇幅问题。这里不多说了。只说几个重要的配置文件。

vim ruby.conf

LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.15/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.15
PassengerDefaultRuby /usr/local/ruby/bin/ruby
</IfModule>

vim redmine.conf

<Location /pm>
RailsEnv production
RailsBaseURI /pm
Options -MultiViews
</Location>

vim subversion.conf


PerlLoadModule Apache::Redmine
<Location /svn>
DAV svn
SVNParentPath "/home/svn"
SVNListParentPath on

Order deny,allow
Deny from all
Allow from (你的服务器IP)这行也可以不要。
Satisfy any
LimitXMLRequestBody 0
SVNPathAuthz off


PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
AuthType Basic
AuthName "Redmine SVN Repository"

Require valid-user
RedmineDSN "DBI:mysql:database=redmine;host=localhost:3306"
RedmineDbUser "redmine"
RedmineDbPass "redmine"
# cache max. 50 passwords
RedmineCacheCredsMax 50
</Location>

其他配置文件基本可以默认不改

需要在httpd.conf和ssl.conf里面把网站根目录给改下。

cd/home/www/

ln-sredmine/public/pm

chown-Rapache.apache*

chmod755-R*

12.建立SVN版本库

cd/home

mkdirsvn

把要迁移的SVN项目库的文件放到/home/svn目录下。

chown-Rapache.apachesvn

chmod-R755svn

授权数据库远程连接grantallprivilegesonredmine.*toredmine@localhostidentifiedby'redmine';

flushprivileges;

grantallprivilegesonredmine.*toroot@'%'identifiedby'redmine';

mysql-uroot-p-h172.16.1.10

13.修改svn和redmien结合文件

svnls--config-dir/tmp/subversion_config--config-optionconfig:auth:store-auth-creds=yeshttps://172.16.1.99/svn/omniv4

cd/home/www/redmine/lib/redmine/scm/adapters

cpsubversion_adapter.rbsubversion_adapter.rb_yy20150820

vimsubversion_adapter.rb

str<<"--no-auth-cache--non-interactive--config-dir/tmp/subversion_config"把一替换文件中的

str<<"--no-auth-cache--non-interactive"这一行

注意修改你的主机名和ip地址对应。否则可能会出错。