Mine Redmine

Hi there, it’s been quite a while since I’ve posted here but anyway, today I’d like to share a personal experience on installing Redmine on Ubunto server with mod_cgi. Yes, I’m aware about the Official HowTo but it lacks several steps which are not obvious if you haven’t read Generic Installation Instructions beforehand and expect that apt-get will do all the job for you – it will not.

So, let’s begin…

  1. Install the required packages. If you’re planning to use another DB then obviously you should select a different redmine-dbname package:
    # apt-get install redmine redmine-mysql
    
  2. Create redmine’s database configuration file /etc/redmine/default/database.yml:
    production:
      adapter: mysql
      database: redmine
      host: localhost
      username: redmine
      password: pa55w0rd
      encoding: utf8
    
  3. Create a dispatch.cgi file /user/share/redmine/public/dispatch.cgi:
    #!/usr/bin/ruby
    
    require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
    
    require "dispatcher" 
    
    ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
    Dispatcher.dispatch
    

    Note. Another option is simple as coping /user/share/redmine/public/dispatch.rb to /user/share/redmine/public/dispatch.cgi.

  4. Configure Apache by adding redmine’s virtualhost section similar to the one presented below:
    <VirtualHost *:80>
            ServerName redmine.<YOUR-DOMAIN>.com
            ServerAdmin webmaster@<YOUR-DOMAIN>.com
            DocumentRoot /usr/share/redmine/public/
            ErrorLog logs/redmine_error_log
    
            <Directory "/usr/share/redmine/public/">
                    Options Indexes ExecCGI FollowSymLinks
                    Order allow,deny
                    Allow from all
                    AllowOverride all
            </Directory>
    </VirtualHost>
    
  5. Next, you’ll have to create either /usr/share/redmine/public/.htaccess file or add the following lines into redmine’s virtualhost section:
    RewriteEngine On
    RewriteRule ^$ index.html [QSA]
    RewriteRule ^([^.]+)$ $1.html [QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
    
  6. Change to /usr/share/redmine and create the database structure:
    # cd /usr/share/redmine 
    # RAILS_ENV=production rake db:migrate
    
  7. Insert default configuration data into the database:
    # RAILS_ENV=production rake redmine:load_default_data
    
  8. The last step is to enable email notifications. To do that edit /etc/redmine/default/email.yml as follows:
    production:
        delivery_method: :sendmail
    

    If you don’t have /usr/sbin/sendmail in your system then there are other options you could use. For more details, please, go here. And don’t forget to restart Apache when you’re done.

  9. Finally, try to access Redmine by going to http://redmine.YOUR-DOMAIN.com url and providing admin/admin to login into the administration account.

The configuration presented above would work with mod_cgi. But there is a problem – it’s slow. To add some speed use passenger module which noticeably increases Redmine experience.

  1. Stop apache and delete dispatch.cgi and .htaccess file you’ve created earlier.
  2. Install the module itself:
    # apt-get install libapache2-mod-passenger
    
  3. Edit /etc/apache2/mods-available/passenger.conf and add:
    PassengerDefaultUser www-data
    
  4. Return to the virtualhost section of your site:
    <VirtualHost *:80>
        ServerName www.myredmine.com
        DocumentRoot /usr/share/redmine/public
    
       RailsEnv production
       RailsBaseURI /
       PassengerEnabled On
       SetHAndler none
       PassengerAppRoot /usr/share/redmine
        <Directory /usr/share/redmine/public>
            Allow from all
            Options -MultiViews
        </Directory>
    </VirtualHost>
    
  5. Restart Apache and you’re ready to go.
  6. Posted on July 19, 2010 at 2:19 pm by sergeyt · Permalink
    In: Linux

    One Response

    Subscribe to comments via RSS

    1. Written by Flagword.net » Upgrading Redmine on Ubuntu 10.04
      on February 15, 2011 at 1:27 pm
      Reply ·