天天看點

Redmine部署

LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch

Distributor ID: CentOS

Description:    CentOS release 6.8 (Final)

Release:        6.8

Codename:       Final

系統更新

yum update

安裝依賴包

yum install -y make apr-devel apr-util-devel \

zlib-devel curl-devel expat-devel gettext-devel \

openssl-devel httpd httpd-devel mysql mysql-server \

mysql-devel libxml2-devel libxslt-devel ImageMagick-devel

<a href="http://tiki.jiagouyun.com/tiki-editpage.php?page=Redmine%E9%83%A8%E7%BD%B2&amp;hdr=2" target="_blank"></a>

tar zxvf ruby-2.3.3.tar.gz

cd ruby-2.3.3

yum install -y gcc*

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

make

make install

添加環境變量:

vi /etc/profile在未尾添加下面一行:

export PATH=/usr/local/ruby/bin:$PATH

使環境變量生效

source /etc/profile

檢查一下安裝是否成功,ruby版本号

ruby –v

安裝zlib和openssl擴充

cd ruby-2.3.3/ext/zlib/

ruby extconf.rb &amp;&amp; make &amp;&amp; make install

cd ruby-2.3.3/ext/openssl/

ruby extconf.rb

vim Makefile

在64行添加

top_srcdir = ../..

<a href="http://tiki.jiagouyun.com/tiki-editpage.php?page=Redmine%E9%83%A8%E7%BD%B2&amp;hdr=3" target="_blank"></a>

tar zxvf rubygems-2.6.8.tgz

cd rubygems-2.6.8

ruby setup.rb

<a href="http://tiki.jiagouyun.com/tiki-editpage.php?page=Redmine%E9%83%A8%E7%BD%B2&amp;hdr=4" target="_blank"></a>

tar zxvf redmine-3.3.1.tar.gz

mv redmine-3.3.1 /usr/local/redmine

chown -R apache: /usr/local/redmine/

修改database.yml配置檔案

cp /usr/local/redmine/config/database.yml.example /usr/local/redmine/config/database.yml

vim /usr/local/redmine/config/database.yml

production:

adapter:mysql2

database:redmine_default //這就是我們後面在mysql裡建立的redmine_default資料庫

host:localhost

username:redmine  //這是我們為redmine資料庫建立的使用者

password:"redmine"  //這是使用者通路redmine資料庫需要的密碼

encoding: utf8

看看是什麼鏡像的,預設的是rubygems.org

gem sources –l

删除原有的鏡像

将源鏡改成ruby-china

安裝bundler

gem install bindler

安裝rdoc

gem install rdoc rdoc-data

安裝rbpdf-font

gem install rbpdf-font

安裝rails

gem install rails

編輯Gemfile,修改gem源

vim /usr/local/redmine/Gemfile

source 'https://gems.ruby-china.org/'

運作buldle install檢查依賴

cd /usr/local/redmine/

bundle install

<a href="http://tiki.jiagouyun.com/tiki-editpage.php?page=Redmine%E9%83%A8%E7%BD%B2&amp;hdr=5" target="_blank"></a>

啟動資料庫,進入資料庫

service mysqld start

mysql

建立資料庫、使用者

mysql&gt; create database redmine_default character set utf8;

mysql&gt; create user 'redmine'@'localhost' identified by 'redmine';

mysql&gt; grant all privileges on redmine_default.* to 'redmine'@'localhost';

mysql&gt; flush privileges;

删除 /usr/local/ruby/lib/ruby/gems/2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb 466行

rake generate_secret_token

RAILS_ENV=production rake db:migrate

RAILS_ENV=production rake redmine:load_default_data

啟動redmine

ruby /usr/local/redmine/bin/rails server webrick -e production -d

<a href="http://tiki.jiagouyun.com/tiki-editpage.php?page=Redmine%E9%83%A8%E7%BD%B2&amp;hdr=6" target="_blank"></a>

apache支援redmine

gem install passenger

passenger-install-apache2-module   一路回車

1、注釋掉原有的ServerName,ServerAdmin,DocumentRoot的資訊;

2、啟用虛拟主機的支援,去掉NameVirtualHost *:80前面的#;

3、在配置檔案的末尾加上:

在httpd.conf添加

LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/2.3.0/gems/passenger-5.0.30/buildout/apache2/mod_passenger.so

&lt;IfModule mod_passenger.c&gt;

PassengerRoot /usr/local/ruby/lib/ruby/gems/2.3.0/gems/passenger-5.0.30

PassengerDefaultRuby /usr/local/ruby/bin/ruby

&lt;/IfModule&gt;

添加redmine配置檔案

vim /etc/httpd/conf.d/redmine.conf

&lt;VirtualHost *:80&gt;

DocumentRoot /usr/local/redmine/public

ErrorLog logs/redmine_error_log

&lt;Directory "/usr/local/redmine/public"&gt;

Allow from all

AllowOverride all

Options -MultiViews

&lt;/Directory&gt;

&lt;/VirtualHost&gt;

本文轉自 freeterman 51CTO部落格,原文連結:http://blog.51cto.com/myunix/1878919,如需轉載請自行聯系原作者