系统环境
cat /etc/redhat-release
CentOS release 6.7 (Final)
uname -r
2.6.32-573.el6.x86_64
1.替换yum源为163。大家都是高手,这里不做详细的交代了。
把这个文件放到/etc/yum.reop下。
yum install -y update
关闭和清理防火墙和selinux
2.
mkdir /tools
cd /tools
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget http://production.cf.rubygems.org/rubygems/rubygems-2.4.5.tgz
Wget http://www.redmine.org/releases/redmine-3.1.0.tar.gz
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.6.tar.gz
3.安装环境
yum -y install libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
4.安装apache和mysql
yum install mysql-community-server mysql mysql-devel httpd httpd-devel mysql-server -y
rpm -ivh epel-release-latest-6.noarch.rpm
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
5.启动mysql
service mysqld start
mysqladmin -u root -p password P@55w0rd
mysql -u root -p
mysql> create database redmine;
mysql> use redmine;
mysql> source /data/redmine.sql
6.安装ruby
cd /tools
tar xzvf ruby-2.1.6.tar.gz
cd ruby-2.1.6
./configure --prefix=/usr/local/ruby
make && make install
cd ..
vim /etc/profile
export PATH=/usr/local/ruby/bin:$PATH 再这行加到文档中export那行后面
source /etc/profile
ruby -v
#ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux]
7.安装rails
cd /tools
tar xzvf rubygems-2.4.5.tgz
cd rubygems-2.4.5
ruby setup.rb
gem -v
#2.4.5
which gem
#/usr/local/ruby/bin/gem
更换gem源为淘宝的源。默认的官方源因为网络问题速度慢
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
gem sources -l 最后只能看到一个淘宝的源
gem install rails -v=4.2
8.安装redmine 3.1
cd /tools
mkdir /home/www
tar xzvf redmine-3.1.0.tar.gz -C /home/www/
cd /home/www
mv redmine-3.1.0/ redmine
cd redmine/
gem install mysql2
配置redmine文件
cd config
cp database.yml.example database.yml
vim database.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
gem install bundler
bundle install --without development test rmagick 这个命令执行后会报错,是说你有依赖没有安装。按他的提示把需要的依赖全部安装就行了。基本是gem install开头的那那段。大概有20-30个依赖。耐心装吧。如果你SHELL玩的好,可以写个脚本装。
gem install json -v '1.8.3'
gem install rake -v '10.4.2'
gem install activesupport -v '4.2.3'
gem install actionview -v '4.2.3'
gem install actionpack -v '4.2.3'
gem install actionmailer -v '4.2.3'
gem install actionpack-action_caching -v '1.1.1'
gem install actionpack-xml_parser -v '1.0.2'
gem install activemodel -v '4.2.3'
gem install activerecord -v '4.2.3'
gem install coderay -v '1.1.0'
gem install railties -v '4.2.3'
gem install jquery-rails -v '3.1.3'
gem install net-ldap -v '0.3.1'
gem install protected_attributes -v '1.1.3'
gem install ruby-openid -v '2.3.0'
gem install rack-openid -v '1.4.2'
gem install rails -v '4.2.3'
gem install rbpdf -v '1.18.6'
gem install redcarpet -v '3.1.2'
gem install request_store -v '1.0.5'
gem install mysql2 -v '0.3.19'
为Rails生成cookies秘钥
rake generate_secret_token
调整文件系统权限
cd /home/www/redmine/
mkdir -p tmp tmp/pdf public/plugin_assets
chown -R apache.apache /home/www/
chmod -R 755 /home/www/
初始化数据库
rake db:migrate RAILS_ENV=production
rake redmine:plugins:migrate RAILS_ENV=production
rake tmp:cache:clear
rake tmp:sessions:clear
测试redmine是否安装成功
ruby /usr/local/ruby/bin/rails server webrick -e production -d
lsof -i tcp:3000 检查端口是否开启
10.配置Redmine在Apache上运行
cd /home/www/redmine/public
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess
chown -R apache.apache /home/www/redmine/
安装Passenger(用于整合Apache)
gem install passenger
passenger-install-apache2-module
11.安装SVN和其他模块。
yum install -y subversion
yum -y install elinks
yum install -y mod_ssl
yum install -y mod_fcgid
yum install -y mod_dav_svn
yum install -y mod_auth_mysql
mkdir -p /usr/lib64/perl5/vendor_perl/Apache/
cd /home/www/redmine/extra/svn
cp Redmine.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
PassengerRoot /usr/local/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.15
PassengerDefaultRuby /usr/local/ruby/bin/ruby
vim redmine.conf
RailsEnv production
RailsBaseURI /pm
Options -MultiViews
vim subversion.conf
PerlLoadModule Apache::Redmine
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
其他配置文件基本可以默认不改
需要在httpd.conf和ssl.conf里面把网站根目录给改下。
cd /home/www/
ln -s redmine/public/ pm
chown -R apache.apache *
chmod 755 -R *
12.建立SVN版本库
cd /home
mkdir svn
把要迁移的SVN项目库的文件放到/home/svn目录下。
chown -R apache.apache svn
chmod -R 755 svn
授权数据库远程连接grant all privileges on redmine.* to redmine@localhost identified by 'redmine';
flush privileges;
grant all privileges on redmine.* to root@'%' identified by 'redmine';
mysql -uroot -p -h 172.16.1.10
13.修改svn和redmien结合文件
svn ls --config-dir /tmp/subversion_config --config-option config:auth:store-auth-creds=yes https://172.16.1.99/svn/omniv4
cd /home/www/redmine/lib/redmine/scm/adapters
cp subversion_adapter.rb subversion_adapter.rb_yy20150820
vim subversion_adapter.rb
str << " --no-auth-cache --non-interactive --config-dir /tmp/subversion_config" 把一替换文件中的
str << " --no-auth-cache --non-interactive" 这一行
注意修改你的主机名和ip地址对应。否则可能会出错。