CentOS 6.5下Redmine的安裝配置

首先引用百度介紹下redmine:php

Redmine是用Ruby開發的基於web的項目管理軟件,是用ROR框架開發的一套跨平臺項目管理系統,聽說是源於Basecamp的ror版而來,支持多種數據庫,有很多本身獨特的功能,例如提供wiki、新聞臺等,還能夠集成其餘版本管理系統和BUG跟蹤系統,例如Perforce、SVN、CVS、TD等等。這種 Web 形式的項目管理系統經過「項目(Project)」的形式把成員、任務(問題)、文檔、討論以及各類形式的資源組織在一塊兒,你們參與更新任務、文檔等內容來推進項目的進度,同時系統利用時間線索和各類動態的報表形式來自動給成員彙報項目進度mysql

在安裝redmine前,咱們須要先來看下各個組件的版本要求:linux

Redmine version Supported Ruby versions Rails version used
current trunk ruby 1.9.3, 2.0.01, 2.1, 2.2 Rails 4.2
trunk < r13482 ruby 1.8.72, 1.9.2, 1.9.3, 2.0.01, 2.1, jruby-1.7.6 Rails 3.2
3.0 ruby 1.9.3, 2.0.01, 2.1, 2.2 Rails 4.2
2.6 ruby 1.8.72, 1.9.2, 1.9.3, 2.0.01, 2.1, jruby-1.7.6 Rails 3.2

目前官網2.0以上版本最新爲2.6.3,由上圖能夠看到咱們須要選擇哪一個版本的組件。c++

1.CentOS 6.5下安裝基本的軟件環境git

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-SHAgithub

2.安裝apache和mysql,並配置redmine數據庫web

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install mysql-community-server httpd -ysql

安裝完成後,service mysqld start,並進行相關數據庫配置數據庫

mysql> create database redmine_db character set utf8;
Query OK, 1 row affected (0.00 sec)apache

mysql> create user 'redmine'@'localhost' identified by 'redmine';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
    
Query OK, 0 rows affected (0.00 sec)

3.iptables設置

若是服務器開了防火牆,咱們須要進行相關設置

/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

4.安裝php環境

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

5.安裝ruby環境

\curl -L https://get.rvm.io | bash
source /etc/profile.d/rvm.sh

[root@usvr-126 ~]# source /etc/profile.d/rvm.sh
[root@usvr-126 ~]# rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p643]
[ruby-]2.1.4
[ruby-]2.1[.5]
[ruby-]2.2[.1]
[ruby-]2.2-head

2.6版本須要ruby 支持的版本,在這咱們選擇1.9.3 穩定版 

rvm install 1.9.3

[root@usvr-126 ~]# ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]

6.安裝rubygems 

yum -y install rubygems

7.安裝redmine的apache支持,這樣能夠經過apache訪問

gem install passenger
passenger-install-apache2-module

命令執行完後按照提示進行配置http:

vim /etc/httpd/conf.d/passenger.conf
  LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-5.0.5/buildout/apache2/mod_passenger.so
  <IfModule mod_passenger.c>
    PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-5.0.5
    PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p551/wrappers/ruby
  </IfModule>

 

vim /etc/http/conf.d/redmine.conf
  <VirtualHost *:80>
      ServerName www.yourhost.com
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /somewhere/public    
      <Directory /somewhere/public>
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
      </Directory>
  </VirtualHost>

因爲咱們的redmine尚未安裝,所以路徑暫時還不配置,等按完redmine後在來配置具體路徑,注意root目錄必須是redmine下的public目錄。 

8.安裝redmine

wget http://www.redmine.org/releases/redmine-2.6.3.tar.gz
tar -zxvf redmine-2.6.3.tar.gz
mv redmine-2.6.3 /data

安裝完畢後,咱們須要在httpd的redmine.conf中進行修改:

  <VirtualHost *:80>
      ServerName 192.168.3.126
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /data/redmine-2.6.3/public
  ErrorLog logs/redmine_error_log
      <Directory /data/redmine-2.6.3/public>
<span style="white-space:pre"> </span> Options Indexes ExecCGI FollowSymLinks
        Order allow,deny
        Allow from all
        # This relaxes Apache security settings.
        AllowOverride all
        # MultiViews must be turned off.
        Options -MultiViews
        # Uncomment this if you're on Apache >= 2.4:
        #Require all granted
      </Directory>
  </VirtualHost>

不要忘了service httpd restart

9.redmine相關配置

cd /data/redmine-2.6.3/public

cp database.yml.example database.yml

注意:官網中說MySQL database using ruby 1.9 (adapter must be set to mysql2)

vim database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8

10.安裝rails,安裝過程當中會出現不少問題,咱們來一一解決吧。 

cd /data/redmine-2.6.3

gem install bundler

bundle install 

這裏會報錯:

An error occurred while installing rack-cache (1.2), and Bundler cannot continue.
Make sure that `gem install rack-cache -v '1.2'` succeeds before bundling.

咱們按照提示安裝所需組件 

gem install rack-cache -v '1.2'

而後再次bundle install,報錯:

An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.

按照提示gem install nokogiri -v '1.6.6.2',再運行bundle install,報錯:

ERROR:  Error installing nokogiri:
 ERROR: Failed to build gem native extension.

按照提示: 

If you are using Bundler, tell it to use the option:
  
    bundle config build.nokogiri --use-system-libraries
    bundle install

咱們來輸入命令:

  bundle config build.nokogiri --use-system-libraries
  bundle install

再次報錯:

An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.

按照提示安裝 gem install json -v '1.8.2',而後再次bundle install

又報錯:

An error occurred while installing railties (3.2.21), and Bundler cannot continue.
Make sure that `gem install railties -v '3.2.21'` succeeds before bundling.

按照提示安裝 gem install railties -v '3.2.21',而後再次bundle install 

又報錯:

An error occurred while installing mysql2 (0.3.18), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.18'` succeeds before bundling.

執行gem install mysql2 -v '0.3.18'報錯:

checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing

咱們執行yum install mysql-devel後成功安裝,接着bundle install 

報錯:

An error occurred while installing redcarpet (2.3.0), and Bundler cannot continue.
Make sure that `gem install redcarpet -v '2.3.0'` succeeds before bundling.

按照提示安裝 gem install redcarpet  -v '2.3.0',而後再次bundle install

 

Please report any bugs. See https://github.com/gemhome/rmagick/compare/RMagick_2-13-2...master and https://github.com/rmagick/rmagick/issues/18

ok,終於安裝成功。 

rake generate_secret_token

初始化redmine數據庫表名

RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

 

11.修改fastcgi‘

cd /data/redmine-2.6.3/public
mkdir plugin_assets
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess

12.安裝mod_fcgi

rpm --import https://Fedoraproject.org/static/0608B895.txt
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum -y install mod_fcgid

13.建立文件目錄

mkdir -p /data/redmine-2.6.3/files
cd /data/redmine-2.6.3/config
cp configuration.yml.example configuration.yml

因爲咱們的files目錄在redmine根目錄下,所以configuration不用配置了,若是files目錄在其餘地方,咱們須要 

vim configuration.yml
attachments_storage_path: /var/redmine/files

14.最後啓動redmine

cd /data/redmine-2
chown -R apache:apache redmine-2.6.3
chmod -R 755 redmine-2.6.3
service httpd restart

測試吧,讓咱們訪問下看看

CentOS 6.5下Redmine的安裝配置

默認的用戶名和密碼都爲admin

另外若apache訪問不了,咱們能夠先用redmine本身的啓動方式啓動,而後ip:3000端口進行訪問,若是訪問成功,則redmine配置沒問題,多是apache的配置問題或漏改配置了

下面是redmine的啓動方式,

[root@usvr-126 redmine-2.6.3]# cd /data/redmine-2.6.3  
[root@usvr-126 redmine-2.6.3]# ruby script/rails server webrick -e production
=> Booting WEBrick
=> Rails 3.2.21 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2015-03-28 01:09:30] INFO  WEBrick 1.3.1
[2015-03-28 01:09:30] INFO  ruby 1.9.3 (2014-11-13) [x86_64-linux]
[2015-03-28 01:09:30] INFO  WEBrick::HTTPServer#start: pid=14577 port=3000

好了,就介紹到這裏吧,這是第二次配,相比第一次容易不少,根據錯誤提示來就可,但願能給你們帶來幫助。

相關文章
相關標籤/搜索