CentOS安装redmine 2后的简单配置

CentOS5.4安装redmine详细步骤

http://blog.csdn.net/leekwen/article/details/8516832

<<<<输出日志的配置>>>>

在页面访问的时候,终端窗口上可能会跳出如下的日志信息:

Started GET "/login" for 192.168.160.20 at Fri Jan 18 01:15:34 -0800 2013
Processing by AccountController#login as HTML
  Current user: anonymous
  Rendered account/login.html.erb within layouts/base (7.7ms)
Completed 200 OK in 39ms (Views: 33.7ms | ActiveRecord: 2.3ms)
Started POST "/login" for 192.168.160.20 at Fri Jan 18 01:15:38 -0800 2013
Processing by AccountController#login as HTML
  Parameters: {"login"=>"登录 »", "back_url"=>"http://192.168.160.11:3000/", "password"=>"[FILTERED]", "username"=>"admin", "utf8"=>"✓", "authenticity_token"=>"NtV3Vej/A7dD6Cn1GFC0oyLNhEvPTOebueDeqlmGKAU="}
  Current user: anonymous
Successful authentication for 'admin' from 192.168.160.20 at Fri Jan 18 09:15:38 UTC 2013
Redirected to http://192.168.160.11:3000/
Completed 302 Found in 113ms (ActiveRecord: 99.8ms)
Started GET "/" for 192.168.160.20 at Fri Jan 18 01:15:38 -0800 2013
Processing by WelcomeController#index as HTML
  Current user: admin (id=1)
  Rendered welcome/index.html.erb within layouts/base (32.8ms)
Completed 200 OK in 100ms (Views: 50.2ms | ActiveRecord: 41.6ms)
Started GET "/admin" for 192.168.160.20 at Fri Jan 18 01:15:43 -0800 2013
Processing by AdminController#index as HTML
  Current user: admin (id=1)
  Rendered admin/_menu.html.erb (124.9ms)
  Rendered admin/index.html.erb within layouts/admin (134.9ms)
  Rendered layouts/base.html.erb (13.6ms)
Completed 200 OK in 168ms (Views: 159.9ms | ActiveRecord: 2.5ms)

这个是因为redmine中的日志选项未做了配置:

[root@localhost ~]# cd /usr/local/redmine-2.1.6/
[root@localhost redmine-2.1.6]# cp config/additional_environment.rb.example config/additional_environment.rb
[root@localhost redmine-2.1.6]# vi config/additional_environment.rb
[root@localhost redmine-2.1.6]# touch log/debug.logs
[root@localhost redmine-2.1.6]# ls -l log/debug.logs
-rw-r--r-- 1 root root 0 Jan 18 02:03 log/debug.logs
[root@localhost redmine-2.1.6]# chown -R redmine:redmine log/
[root@localhost redmine-2.1.6]# chmod -R 755 log/
[root@localhost redmine-2.1.6]# cat config/additional_environment.rb
# Copy this file to additional_environment.rb and add any statements
# that need to be passed to the Rails::Initializer.  `config` is
# available in this context.
#
# Example:
#
#   config.log_level = :debug
#   ...
# !!!请确信目录中保存的日志文件是存在的!!!

config.logger = Logger.new("/usr/local/redmine-2.1.6/log/debug.log", 2, 1000000)
config.logger.level = Logger::INFO

<<<<以服务的形式启动redmine>>>>

可以修改/etc/rc.local文件,将redmine以服务启动的脚本加入其中:

[root@localhost redmine-2.1.6]# vi /etc/rc.local

[root@localhost redmine-2.1.6]#cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
# add those line for redmine demon
/usr/local/redmine-2.1.6/script/rails server webrick -e production -d
# add end

如果要重启redmine请直接进行关闭,然后再运行一下/etc/rc.local文件即可,具体操作如下:

[root@localhost redmine-2.1.6]# killall -9 ruby
[root@localhost redmine-2.1.6]# . /etc/rc.local
=> Booting WEBrick
=> Rails 3.2.11 application starting in production on http://0.0.0.0:3000
[root@localhost redmine-2.1.6]# netstat -tln |grep :3000
tcp        0      0 0.0.0.0:3000                0.0.0.0:*                   LISTEN
[root@localhost redmine-2.1.6]# ps -aux |grep ruby
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root  557  0.0 12.6  71880 65156 ?    S    19:01  0:00 ruby /usr/local/redmine-2.1.6/script/rails server webrick -e production -d
root  584  0.0  0.1   3916 668 pts/2  S+   19:01   0:00 grep ruby

<<<<提升redmine的访问速度>>>>

这个有两种方式:一种是安装mongrel(局域网速度会提升),一种是将redmine与httpd服务整合在一起。

第一种mongrel安装相对简单:

注:必须进入redmine的安装目录下运行

[root@localhost redmine-2.1.6]# gem install mongrel

Building native extensions.  This could take a while...
Successfully installed mongrel-1.1.5
1 gem installed
Installing ri documentation for mongrel-1.1.5...
Installing RDoc documentation for mongrel-1.1.5...
[root@localhost redmine-2.1.6]# killall -9 ruby

[root@localhost redmine-2.1.6]# . /etc/rc.local
=> Booting WEBrick
=> Rails 3.2.11 application starting in production on http://0.0.0.0:3000

第二种方式是利用apache来运行redmine:

这个配置相对于第一种方式来说是要复杂一点。

具体操作如下:

[root@localhost ~]# cd /usr/local/redmine-2.1.6/

[root@localhost redmine-2.1.6]# gem install passenger
Fetching: fastthread-1.0.7.gem (100%)
Building native extensions.  This could take a while...
Fetching: daemon_controller-1.1.1.gem (100%)
Fetching: passenger-3.0.19.gem (100%)
Successfully installed fastthread-1.0.7
Successfully installed daemon_controller-1.1.1
Successfully installed passenger-3.0.19
3 gems installed
Installing ri documentation for fastthread-1.0.7...
Installing ri documentation for daemon_controller-1.1.1...
Installing ri documentation for passenger-3.0.19...
Installing RDoc documentation for fastthread-1.0.7...
Installing RDoc documentation for daemon_controller-1.1.1...
Installing RDoc documentation for passenger-3.0.19...
[root@localhost redmine-2.1.6]# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v3.0.19.
This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.
Here's what you can expect from the installation process:
 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.
Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.
Press Enter to continue, or Ctrl-C to abort.
--------------------------------------------
Checking for required software...
 * GNU C++ compiler... found at/usr/bin/g++
 * Curl development headers with SSL support...found
 * OpenSSL development headers... found
 * Zlib development headers... found
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /usr/bin/rake
 * rack... found
 * Apache 2... found at /usr/sbin/httpd
 * Apache 2 development headers... found at /usr/sbin/apxs
 * Apache Portable Runtime (APR) development headers...found at /usr/bin/apr-1-config
 * Apache Portable Runtime Utility (APU) development headers...found at /usr/bin/apu-1-config
--------------------------------------------
Compiling and installing Apache 2 module...

cd /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19
/usr/bin/ruby /usr/bin/rake apache2:clean apache2 RELEASE=yes
# /usr/bin/ruby /usr/bin/rake apache2:clean apache2 RELEASE=yes
rm -rf ext/common/libboost_oxt.a ext/common/libboost_oxt

-------------中间省略------------------------
--------------------------------------------
The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19
   PassengerRuby /usr/bin/ruby


After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

Press ENTER to continue.
--------------------------------------------
Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

   <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
      </Directory>
   </VirtualHost>


And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
https://www.phusionpassenger.com
Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
[root@localhost redmine-2.1.6]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.old
[root@localhost redmine-2.1.6]# vi /etc/httpd/conf/httpd.conf
[root@localhost redmine-2.1.6]# tail -n 21 /etc/httpd/conf/httpd.conf
# Redmine Configure Start
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
    PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19
    PassengerRuby /usr/bin/ruby
    PassengerUser apache
<VirtualHost *:80>
    ServerName www.localhost.com
# !!! Be sure to point DocumentRoot to 'public'!
    DocumentRoot /var/www/html/
    ErrorLog logs/redmine_error_log
    AddHandler cgi-script .cgi
    <Directory "/var/www/html/">
      Options Indexes -MultiViews FollowSymLinks ExecCGI
      Order allow,deny
      Allow from all
      AllowOverride all
      RailsEnv production
      RailsBaseURI /redmine
    </Directory>
</VirtualHost>
# Redmine Configure End
[root@localhost redmine-2.1.6]# ln -s /usr/local/redmine-2.1.6/public/ /var/www/html/redmine
[root@localhost redmine-2.1.6]# chown -R apache:apache /usr/local/redmine-2.1.6
[root@localhost redmine-2.1.6]# chown -R apache:apache /var/www/html/redmine

[root@localhost redmine-2.1.6]#touch /etc/httpd/logs/redmine_error_log
[root@localhost redmine-2.1.6]# chown -R apache:apache /etc/httpd/logs/
[root@localhost redmine-2.1.6]# service httpd start
Starting httpd:                                            [  OK  ]

查看是否有80端口,以确定httpd是否成功启动:

[root@localhost redmine-2.1.6]# netstat -tln 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:641                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 :::22                       :::*                        LISTEN
查看httpd启动时,是否有错误日志:

[root@localhost redmine-2.1.6]#cat /etc/httpd/logs/error_log
[Tue Jan 22 01:16:36 2013] [notice] SELinux policy enabled; httpd running as context root:system_r:httpd_t:s0
[Tue Jan 22 01:16:36 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jan 22 01:16:36 2013] [error] *** Passenger could not be initialized because of this error: Unable to start the Phusion Passenger watchdog (/usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/agents/PassengerWatchdog): Permission denied (13)
[Tue Jan 22 01:16:36 2013] [notice] Digest: generating secret for digest authentication ...
[Tue Jan 22 01:16:36 2013] [notice] Digest: done
[Tue Jan 22 01:16:36 2013] [error] *** Passenger could not be initialized because of this error: Unable to start the Phusion Passenger watchdog (/usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/agents/PassengerWatchdog): Permission denied (13)
[Tue Jan 22 01:16:36 2013] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations
查看SELinux是否关闭:

[root@localhost redmine-2.1.6]#getenforce
Enforcing
[root@localhost redmine-2.1.6]# echo "/usr/sbin/setenforce 0" >> /etc/rc.local
[root@localhost redmine-2.1.6]# source /etc/rc.local
[root@localhost redmine-2.1.6]# getenforce
Permissive
[root@localhost redmine-2.1.6]# service httpd restart

Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

[root@localhost redmine-2.1.6]# netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:641                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 :::80                       :::*                        LISTEN
tcp        0      0 :::22                       :::*                        LISTEN

然后就可以对 http://IP_ADDR/redmine 对redmine进行配置了。

<<<<上传附件大小配置>>>>

这个可采用两种方式,一种是直接进入页面修改,另一种是可以直接编辑配置文件:

[root@localhost redmine-2.1.6]# vi config/settings.yml

<<<<上传附件的位置、SCM及邮件的配置>>>>

这个可采用两种方式,一种是直接进入页面修改,另一种是可以直接编辑配置文件:

[root@localhost redmine-2.1.6]# vi config/configuration.yml

<<<<默认及用户语言设置>>>>

登录时用户名和密码都为admin,进入之后可以对其进行设置。

默认语言为english, 在settings->display->Default language 里修改成“简体中文”就可以了。

对不同用户可以选择使用不同的显示语言,如果要修改自己的显示语言的话,只需要在个人账户里修改就可以了。

user-->general-->language修改即可。

<<<<插件的安装>>>>

这里我只说明一下,插件可以直接从 此地址下载http://www.redmine.org/plugins

对应版本的插件,然后放到redmine安装目录下的plugins本目录后,按照插件的说明安装即可。

关于redmine更高级的配置,请直接google或参见redmine官方HowTo文档。

原文地址:https://www.cnblogs.com/xiaoleiel/p/8340171.html