Install Redmine 2.5.x with Git and Subversion on Debian with Apache2, RVM and Passenger

Update 2018-07-14:

This guide is now outdated
An updated version is available for Debian 9 and Redmine 3.x

Update 2014-07-12:

Added troubleshooting suggestions and warning about multiple services running on the server.

Update 2014-07-10:

Added details about self-signed certificates.

Update 2014-05-20:

Added support for HSTS and commented OCSP stapling.

Before starting:

This is a detailed guide. Experienced users may only want commands to run  
For Ubuntu 14.04 instructions 

We will prefer to work in the new, clean Virtual Machine. My preference goes to XenServer which can run on top of almost any hardware (Configure backups!).

I recommend you give at least 1GB of RAM to your Redmine box.

This tutorial was written for Redmine 2.5.x but it should be compatible with future versions

Before anything else, we will make sure that the packages are up to date:

apt-get update && apt-get upgrade

Getting Ruby

The compatibility list is available on Redmine’s official website. As time of writing, Ruby 2.1.x is NOT supported.

Install Ruby 2.0.0 with RVM:

apt-get install curl
curl -sSL https://get.rvm.io | bash -s stable --ruby=2.0.0
su - #Reload user variables, alternatively you can relog

Note that you can list available rubies with:

 rvm list known

Getting Redmine

We will also want to to use Subversion to checkout Redmine and Git for our SCM

apt-get install git subversion

Redmine dependencies

 apt-get install imagemagick libmagickwand-dev

Get Redmine, as time of writing, the newest stable branch is 2.5-stable.

cd /opt/
mkdir redmine
cd redmine/
svn co http://svn.redmine.org/redmine/branches/2.5-stable current
cd current/

Fix permissions:

mkdir -p tmp tmp/pdf public/plugin_assets
chown -R www-data:www-data files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

Create repositories root

mkdir -p /opt/redmine/repos/svn /opt/redmine/repos/git
chown -R www-data:www-data /opt/redmine/repos

Create the MySQL database

We will use MySQL, note that the dev library is required to compile the mysql2 gem native extention

Note that ‘my_password’ needs to be replaced by a strong password!
apt-get install mysql-server libmysqlclient-dev

We start the MySQL Console to create the database:

 mysql -uroot -p

Then, in the MySQL console:

CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Configure Redmine

Time to edit the Redmine configuration:

cp config/configuration.yml.example config/configuration.yml
cp config/database.yml.example config/database.yml
nano config/database.yml

Edit such as:

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "my_password"
  encoding: utf8

Don’t forget to replace “my_password” by your actual password created earlier.

Preserve the indentation, all lines but the first are indented by 2 spaces.

Let the bundler install the Gem dependencies:

bundle install --without development test

Ready Redmine’s database:

bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data

Install and configure the web server

We need a bunch of packages

apt-get install apache2 apache2-threaded-dev libcurl4-gnutls-dev apache2 libapache2-svn\
libapache-dbi-perl libapache2-mod-perl2 libdbd-mysql-perl libauthen-simple-ldap-perl openssl

Time to enable the required modules:

a2enmod ssl
a2enmod perl
a2enmod dav
a2enmod dav_svn
a2enmod dav_fs
a2enmod rewrite
a2enmod headers

We install Passenger to serve Redmine:

gem install passenger
passenger-install-apache2-module

Follow the instructions at the end of the Passenger installation to create your Passenger Apache configuration. Do NOT copy the example below as it will very probably fail. It should look like:

/etc/apache2/conf.d/passenger.conf

# Do NOT copy this configuration file, you need to create your owen with the output of `passenger-install-apache2-module`
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p451/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p451/gems/passenger-4.0.41
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.0.0-p451/wrappers/ruby
</IfModule>

Load the Redmine.pm library for Repository authentication

ln -s /opt/redmine/current/extra/svn/Redmine.pm /usr/lib/perl5/Apache2/

Create SSL Self-signed certificate

If you are not familiar with self-signed certificates, please read:

SSL provides 2 protections: 1: Encryption (prevents eavesdropping) 2: Authentication of the server (prevents a malicious server to pretend to be your server).

Self-signed certificates only provide encryption. It means that browsers will display a warning telling that  the authenticity of the certificate could not be verified. To prevent that, you can:

  • Remove SSL by haveing only a VirtualHost on port 80(which is arguably acceptable for an isolated private network)
  • Get a free valid certificate for example from StartSSL
  • Purchase a valid certificate from a vendor of your choice

Gurus out there will know that it is actually more to it but it is not the topic of this article.

I use self-signed certificates for this article because it is simple, immediate, free and better than nothing.

We create the certificate with OpenSSL. Set the “Common Name” to the name of your  domain name  for example redmine.domain.com

mkdir /etc/apache2/ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/apache2/ssl/redmine.key -out /etc/apache2/ssl/redmine.crt

Apache2 configuration

We can now create our Apache2 configuration files:

You need to replace ‘my_password’ by your MySQL redmine user password (2 instances). You also need to replace redmine.domain.com by your domain name in both files

Files should be placed  in /etc/apache2/sites-available/

redmine.vhost
redmine-redirect.vhost

Alternatively, you can download the files directly on the server:

cd /etc/apache2/sites-available
wget https://gist.githubusercontent.com/martin-denizet/11080033/raw/46d6da9217aa249eda8d0203102380e1ba62f774/redmine.vhost
wget https://gist.githubusercontent.com/martin-denizet/11080033/raw/8cc96e73a43d9ff65b855c9dc1b81c05897ab7fc/redmine-redirect.vhost
Note that Perfect Forward Secrecy is configured
If your server is NOT hosting any other services or websites, you may disable the default configuration:

a2dissite default

If you were using the default configuration for other services, disabling it would make these services unavailable.

Enable the configuration:

a2dissite default
a2ensite redmine.vhost
a2ensite redmine-redirect.vhost
service apache2 restart

Time to Celebrate!

There you go, your Redmine instance should be up in running!
Test it at http://redmine.domain.com (replace with your settings)
Username: admin
Password: admin

If Redmine or another service on the server doesn't show up
If Redmine or another service on the server doesn’t show up, it’s most likely because you have other sites configured.

  • If you have a DNS name dedicated to Redmine:Verify the ServerName property in redmine.vhost
  • If you have no DNS name dedicated to Redmine:Option1: Remove the HTTP redirection and keep Redmine only on HTTPS, to do so, run:
    a2dissite redmine-redirect
    service apache2 restart

    Option2: Move Redmine to a Sub-URI (mydomain.com/redmine)

What now

You may want to check that your configuration is correct in https://redmine.domain.com/admin/info

You may also want to configure your email server in: /opt/redmine/current/config/configuration.yml

[Optional] Install Create Git plugin

cd /opt/redmine/current/plugins/
git clone https://github.com/martin-denizet/redmine_create_git.git
bundle install
service apache2 restart

93 Comments

  1. Eric April 29, 2014 10:57 pm  Reply

    This was a wonderful guide! Thanks! How can you integrate SVN and GIT to create repositories on project creation?

  2. FXS May 1, 2014 1:36 pm  Reply

    Hello,

    Thank you for this excellent guide. I succeed to install redmine by this way. My configuration is Xubuntu 14.04 and I needed to make some changes but I don’t think it is specific to Ubuntu :

    – For the installation of RVM in Multi-user, I didn’t succeed with your method and I follow the install documentation on RVM site and it works :
    Under : curl -sSL https://get.rvm.io | sudo bash -s stable –ruby=2.0.0
    sudo adduser rvm

    – When I run bundle install … there is an error with bundler. This was because
    bash was started as an interactive non-login shell.
    After running : /bin/bash –login all was Ok.

    – I needed to reboot before installing passenger

    – Apache : The package apache2-threaded-dev is now replaced by apache2-dev.
    For recent version of apache the content of passenger.conf must be split in 2 files.
    In /etc/apache2/mods-available/passenger.load the LoadModule directive
    In /etc/apache2/mods-available/passenger.conf the “<IfModule … ” directives.
    Activate module with a2enmod passenger and restart apache
    In redmine.vhost
    “Options Indexes FollowSymLinks -MultiViews” should be replaced by “Options +Indexes +FollowSymLinks -MultiViews”
    And lines “Order allow,deny / allow from all” by “Require all granted”

    It was necessary for me to add the equivalent of redmine.domain.com /etc/hosts

    • Martin DENIZET May 4, 2014 7:41 pm  Reply

      Thank you for your feedback FXS.
      I tested that install on a fresh Debian 7 minimal net-install.
      I will use your feedback to write the equivalent article for Ubuntu 14.04 as it seems to be a more common choice.
      Why is the +Indexes option required?
      Thanks!

  3. Clinton Collins May 4, 2014 3:18 am  Reply

    Martin, this is a great guide. With this guide and the comments from FXS I was able to get a working install of redmine 2.5.1.stable.13127 on ubuntu server 14.04LTS.

    I need to migrate the database from redmine version 2.3.2 into the 2.5.1 version. Could you offer some advice or a pointer for doing that? My initial attempt with the redmine_bak process documented on the redmine site was not successful. 2.5.1 generates internal server errors after trying the database import.

    • Martin DENIZET May 4, 2014 7:35 pm  Reply

      Hello Clinton,
      Thank you for your comment.
      From what I understand, you are migrating from a server to a new one running Ubuntu 14.04.
      If so, you need to, on the old server:
      * Backup your DB: mysqldump -u -p > /path/to/backup/db/redmine_`date +%y_%m_%d`.sql
      * Copy required files over to the new server:
      ** secret token: config/initializers/secret_token.rb
      ** Your files(Redmine attachments): files/*
      ** Your DB backup over to the new server
      ** You may want also to save your settings file config/settings.yml as it contains email configuration and secret for LDAP passwords.
      Copying files with scp looks like:scp /opt/redmine/current/files/* newserver:/opt/redmine/current/files/
      Then on the new server:
      * Restore the DB: mysql -u -p < /path/to/backup/db/redmine_`date +%y_%m_%d`.sql
      * Migrate the DB: bundle exec rake db:migrate RAILS_ENV=production
      * Get compatible versions of the plugins you use
      * Restart your instance: service apache2 restart

      Note that you need to create the DB before restoring the backup if you didn't do it yet:
      CREATE DATABASE redmine CHARACTER SET utf8;

      I hope I didn't forget anything.

      Cheers,

  4. Clinton Collins May 5, 2014 4:21 am  Reply

    I now have my data migrated from 2.3 to 2.5. The basic problem is that if you create a functional 2.5 site with a 2.5 database you have to delete the 2.5 database first (no one mentions this), then create a blank database and then import the 2.3 database.

    The 2.5 database has tables that do not exist in 2.3 and the command: “bundle exec rake db:migrate RAILS_ENV=production” will stop if it encounters an existing table leaving you with a broken database.

    So, here are the general steps:

    1. Get a working 2.5 site.
    2. Log into mysql as the superuser and drop the redmine database.
    3. Import the data from your old site with mysql -u -p databasename < /path/to/oldsite_backup/db/databasename.sql
    4. Run bundle exec rake db:migrate RAILS_ENV=production in the root directory of your redmine install (the location of your Gemfile file) or if you followed Martin's guide – /opt/redmine/current.

    I'm really impressed this worked. Everyone who has worked on this project should be congratulated for their fine work.

    I really like Martin's setup since this structure will make it easy to create a symlink to a future update and just point the current directory to whatever happens to be current. Thanks again Martin for your contributions!

    • Clinton Collins May 5, 2014 4:25 am  Reply

      I left out a step:

      Insert this step between 2 and 3.

      2.5 Create a blank redmine database:
      CREATE DATABASE redmine CHARACTER SET utf8;
      GRANT ALL PRIVILEGES ON redmine.* TO ‘redmine’@’localhost’;

      Note: You have already created the redmine user – no need to create the user again.

    • Martin DENIZET May 5, 2014 11:57 am  Reply

      Hi Clinton,
      Glad you got your migration working!
      Minor updates like 2.5.2 will be as simple as:
      * svn update (get laltest from 2.5-stable branch)
      * bundle update (Update environment)
      * bundle exec rake db:migrate RAILS_ENV=production (Update the database schema)
      * service apache2 restart

      Of course it’s advised to do a backup before.

      The structure I use in production is actually self-contained in /opt/redmine, I symlink all the configuration files. It was proved not to be so useful over the years because the update process goes very smoothly.
      The only problem I got is plugins that are not compatible and need updating.

      I’ll write about that in a future article.

      Cheers!

  5. Vinicius May 6, 2014 2:13 am  Reply

    Great guide! Got it working, only problem I had was that redmine was not connecting to the database, I had to run a “mysqld –skip-grant-tables”.
    But now, for production, I need to use PostgreSQL. Do you know what changes in this guide to use PostgreSQL(libs, gems, etc)?

    Thanks

    • Martin DENIZET May 7, 2014 4:28 pm  Reply

      Hi Vinicius,
      Thanks for your comment.
      I added a FLUSH PRIVILEGES; that should solve the problem you experienced. I didn’t add it in the first place because it worked without during my test installs.
      To use PostgreSQL, you just need to create the database and configure it correctly with the PG adapter in database.yml.
      The only thing is that you will need the dev lib to be able to build the PG gem when you will run a bundle install.
      apt-get install libpq-dev should install to correct dependency to be able to successfully install the PG gem.
      You will find some instruction on installing with Postgre in the official instructions.
      Cheers,

  6. Vinicius May 8, 2014 4:09 am  Reply

    Thanks Martin! It worked fine!
    Cheers

  7. FXS May 13, 2014 12:56 pm  Reply

    @Martin DENIZET
    Hello,
    Without “+” I have this following error “Either all Options must start with + or -, or no Option may”.

  8. JS May 27, 2014 4:50 pm  Reply

    Hi Martin,

    Thanks for this guide. But i have a problem.
    All the procedure was fine but at the last step, when i wanted to log in redmine, i’ve got an error 500 …
    Do you have any idea ?
    I worked with a fresh install of debian 7.5 (netinst).

    • Martin DENIZET May 27, 2014 4:57 pm  Reply

      Hello JS,
      Can you please check the content of the logs.
      It can be in the Apache log:
      tail -100 /var/log/apache2/error.log
      tail -100 /var/log/apache2/redmine.error.log

      Or in the Redmine log:
      tail -100 /opt/redmine/current/log/production.log
      Cheers,

  9. JS May 27, 2014 5:13 pm  Reply

    I just discover the error.log in apache and there is a lot of things that i don’t understand.

    the file here : http://dl.free.fr/jnbEoGC3C

    Thanks you very much for your help … i’m a bit lost here.

    • Martin DENIZET May 27, 2014 5:29 pm  Reply

      It seems your database is not initialized.
      Try to run again the migration and send me the output:

      cd /opt/redmine/current
      RAILS_ENV=production bundle exec rake db:migrate

  10. JS May 27, 2014 5:29 pm  Reply

    Hi Martin,

    I just find the problem thanks to the log.
    I don’t know why but the redmine database was empty … I fix that and the connexion is ok now.
    Thanks for your help and thanks again for this guide !!

    • Martin DENIZET May 27, 2014 5:31 pm  Reply

      Great! Good to hear your problem is solved, have a nice day!

  11. Leo May 30, 2014 1:07 am  Reply

    I was following this tutorial from start to finish, but when I try to run this command:
    RAILS_ENV=production bundle exec rake db:migrate

    I get this error:
    Could not find command “exec rake”.

    Any ideas? Thank you so much.

    • Martin DENIZET May 30, 2014 1:32 am  Reply

      Hello Leo,
      Try this:
      bundle exec rake db:migrate RAILS_ENV=production
      or
      rake db:migrate RAILS_ENV=production
      you have to cd /opt/redmine/current before running the commands
      Tell me if it works.
      Cheers,

      • alex August 5, 2014 9:44 pm  Reply

        Hi Martin,

        Great write up.

        ‘Could not find command “exec rake”.’

        This worked for me:
        bundle exec rake db:migrate RAILS_ENV=production

        • Martin DENIZET August 8, 2014 6:41 pm  Reply

          Hi Alex,
          Thank you for your feedback, it seems you’re not the only one who add this issue. It seems it works for some people but not for others and I’ve no clue why.
          Cheers!

  12. MJ May 30, 2014 7:15 am  Reply

    Hi Martin,

    thank you for this guide, I used a ubuntu 14.04 virtual machine image to try it, and only two issues came up:

    1. ‘bundler’ was not already installed on the vm, so i included it into the first line of apt packages to install. (I later read your update on having to relog the user)

    2. The website didn’t come up. It still shows the default “Hello apache” site and won’t switch to the redmine install.

    Error and access log of apache do not give any clue. The apache running is v2.4.7. On the first glance, i didn’t see anything wrong with the redmine.vhost and redmine-rediract.vhost either. Could you give a clue?

    Thanks again for the guide!

  13. Martin DENIZET May 30, 2014 1:22 pm  Reply

    Hello MJ,
    Thing go quite differently on Ubuntu 14.04. I wrote an article specifically for it: https://martin-denizet.com/install-redmine-2-5-x-git-subversion-ubuntu-14-04-apache2-rvm-passenger/
    For the Bundler it comes directly with rvm under Debian but not on Ubuntu 14.04 (I think it’s a permission thing).
    My advise is to use gem to install the bundler:
    gem install bundler
    For the default welcome screen showing, do:

    sudo a2dissite 000-default
    sudo service apache2 restart

    Here again, the instruction are a little different between Ubuntu and Debian.
    Tell me if it works.
    Cheers,

    • MJ May 30, 2014 3:29 pm  Reply

      Works like a charm indeed.

      Thanks for the quick response, I will forward your work!

      • Martin DENIZET May 30, 2014 5:43 pm  Reply

        Great! Good to know it’s working.
        Have a nice day!

  14. john May 31, 2014 12:25 am  Reply

    Hey Martin,
    Very well done installation guide! Naturally, I have a twist…We’ve been using redmine with jruby.

    I think it’s almost ready to go but I’m getting the following error when I restart apache:
    Syntax error on line 10 of /etc/apache2/sites-enabled/000-default:
    Invalid command ‘RailsBaseURI’, perhaps misspelled or defined by a module not included in the server configuration
    Action ‘configtest’ failed.
    The Apache error log may have more information.

    I don’t see any obvious syntax errors and the the error log has no entries from today.

    RailsBaseURI /redmine
    PassengerResolveSymlinksInDocumentRoot on

    Am I missing some quotes somewhere? Any suggestions on where I should look to debug?

    Again, thanks so much for putting this guide out there. I’ve been looking for something along these lines for quite a while.

    • Martin DENIZET May 31, 2014 12:55 am  Reply

      Hello John,
      It seems like Passenger is not loaded. Check how you load passenger, the clean what to do it on Debian is in: /etc/apache2/conf.d/passenger.conf
      /etc/apache2/conf.d/* is loaded before the sites. (Unless you hacked in the config files)
      Hope it helps.
      Cheers,

  15. MJ May 31, 2014 2:30 am  Reply

    Hallo Martin,

    as I said, your standard setup works very well according to your tutorial. I was trying to move the redmine Installation to a suburi like https://xxx.xxx.xxx.xxx/redmine. However, I can’t get this to work. Can you point me to a resource to go to during my investigation?

    Thanks,
    MJ

    • MJ May 31, 2014 6:47 pm  Reply

      Nevermind, I just rearranged the site-config files an now it works.

  16. David Todd June 23, 2014 10:07 pm  Reply

    Redmine 2.5 / Ruby 2.0.0 / rvm / Raspbian / Raspberry Pi Model B

    Martin: EXCELLENT instructions! Installed on my Raspberry Pi in two tries. First try failed because I’d installed rvm for personal use, and subsequent scripts got the wrong version of Ruby in some cases, resulting in a very confused install.

    For those who want to do this on Raspbian: my config is Model B PI, not overclocked, 256MB allocated to video (only 256MB to system — might want to decrease video to 128MB for this install since I think there was a good deal of swapping during compiles). OS running on an 80GB USB-attached hard drive. Linux Pi-2 3.12.22+ #691

    Read Martin’s instructions and all the comments, especially noting those of FXS since they apply to this install on Raspbian, and follow pretty much exactly as given by Martin subject to FXS’s modifications. As prep for the second install, knowing that I’d had confusion with the “native” ruby 1.8.x and 1.9.x, I removed the link “/usr/bin/ruby” (just the link, not the /usr/bin/ruby1* files). As a result, “ruby -v” fails: the system can no longer confuse earlier versions with the 2.0.0 version you’re about to install.

    First modification to Martin’s instructions: install rvm and ruby 2.0.0 as root, as suggested by FXS, using
    sudo curl -sSL https://get.rvm.io | sudo bash -s stable –ruby=2.0.0

    After a successful install, I did a
    source /usr/local/rvm/scripts/rvm
    from both the pi account and root account, to make sure that “ruby -v” gave a response, indicating that the correct version of ruby was being referenced.

    As you follow the rest of the instructions, some steps will fail because the parent directory is protected against writes; “ls -lad” the directory, noting protection; “sudo chmod 777” the parent directory; rerun the step; and then “sudo chmod 755 [generally it was 755 to start with]” the directory back again. That’s really the only sort of diversion in the procedure that’s needed.

    Expect VERY long compile times at the steps
    bundle install –without development test
    and
    passenger-install-apache2-module
    — perhaps up to 2 hrs each. Just be patient … eventually they finish.

    On first connection to the web service, the service times out waiting for a response. Let it, then try again and it starts up. (Same thing happens after a reboot of the Pi, as it loads the processes on first web reference … might perform better on a Pi configured with only 128MB of video RAM). Performance is quite reasonable after the first startup.

    I connect with a web address of “pi-2/redmine” (the Raspberry Pi has hostname “pi-2”). I haven’t been able to get virtual host web connection to work (e.g., redmine.pi-2). I’m guessing that’s because I don’t have a FQDN for the Pi or named in the config files … not important to me at this point for testing. But I didn’t finish up with FXS’s edits on the vhost file, so I’ll go back and see if that fixes it.

    Again, Martin, thanks for the excellent instructions: clear, precise, and systematic. I hope my additions will help those who want to set up redmine 2.5 on a Raspberry Pi.

    • David Todd June 27, 2014 12:26 pm  Reply

      Following up on my earlier post regarding installation of redmine 2.5 on Raspian / Raspberry Pi, I applied the redmine.vhost edits suggested by FXS (above)

      In redmine.vhost
      “Options Indexes FollowSymLinks -MultiViews” should be replaced by “Options +Indexes +FollowSymLinks -MultiViews”
      And lines “Order allow,deny / allow from all” by “Require all granted”

      Applying both caused the web internal service to fail completely, but leaving the first installed and reversing the second, so it was unchanged from the original .vhost file, resulted in a working server that responds to both /redmine and redmine.

      • David Todd June 27, 2014 12:29 pm  Reply

        that should have read hostname/redmine and redmine.hostname

    • Martin DENIZET June 28, 2014 2:12 pm  Reply

      Hi David,
      Thank you for this very interesting feedback. I’m surprised you got enough RAM to compile!
      I’ll Maybe use it as a base for an article dedicated to Raspbian.
      Cheers!

  17. noob June 30, 2014 10:10 pm  Reply

    Hi David,

    Thank you so much for sharing this excellent tutorial.

    One thing though … it might be just me being dumb, but I just spent about two hours trying to get this to work. I then discovered that database.yml had to be indented like so:

    production:
    adapter: mysql2
    database: redmine
    host: localhost
    username: redmine
    password: “my_password”
    encoding: utf8

    This file HAS to be indented like this using spaces and NOT tabs. In your tutorial above, you don’t have any indentation when editing this file 🙂

    Just thought I should share if anybody else is getting stuck on this.

    • noob June 30, 2014 10:11 pm  Reply

      ugh … the indentation doesn’t show in my comment, but every line below the ‘production:’ line has to be indented 🙂

      • Martin DENIZET July 1, 2014 1:03 pm  Reply

        Hello, I’m sorry to hear about your trouble. I’m pretty sure I had the indentation right at some point. Might have lose it when I changed highlighting plugin.
        I corrected the indentation and added a warning message.
        Thanks for your contribution!

  18. Supal Choudhary July 4, 2014 9:15 pm  Reply

    How to solve this issue?

    Can’t connect to MySQL server on ‘127.0.0.1’ (111) (Mysql2::Error)

    I can login through mysql -uredmine -p but redmine cannt connect to mysql server.

    • Martin DENIZET July 4, 2014 9:59 pm  Reply

      Hello Supal,
      If the user is correct then you should look at the following:
      * Did you preserve correctly the indentation in the database.yml? (it’s whitespacwe sensitive. Use an editor such as Notepad++ able to show the whitespaces and EOL)
      * Are you using the wrong Rails environment? (for example development instead of production). Each environment has a different database configuration.

      How about you send me over your database.yml?

  19. Julien July 18, 2014 11:54 pm  Reply

    Successfully installed redmine following your tutorial, one shot. Thanks a lot!

    • Martin DENIZET July 19, 2014 2:05 am  Reply

      Hi Julien. Awesome! Thanks for sharing your experience, it’s always great to know when contributions are useful to the community.
      I wish you happy coding with your fancy new Redmine!

  20. Mike July 29, 2014 6:18 am  Reply

    Hello Martin, thank you for your wonderful tutorial!

    Everything concerning redmine works great, I am however having trouble with the redmine_create-git plugin: I get the following error when upon creating a project I click on the “Quick create [Crate Git plugin] link:

    NoMethodError (undefined method ’empty?’ for nil:NilClass):
    plugins/redmine_create_git/app/controllers/create_git_controller.rb:44:in ‘check_settings’

    I am running on a fresh debian wheezy installation with
    ruby-2.0.0-p481
    gem 2.2.2
    redmine 2.5
    git 1.7.10.4

    Any clues as to what I might be doing wrong? Thanks!

    • Martin DENIZET August 9, 2014 7:16 am  Reply

      Hello Mike,
      Sorry for the late reply I was on holidays.
      You didn’t configure the settings of the plugin I presume. Try to configure it in the plugin page and try again.
      I need to add a fail-safe here…
      Thanks for the feedback!

  21. ds Han August 7, 2014 4:44 pm  Reply

    thanks for your guide reference. Unfortunately my redmine server is not working now.

    My web page just show this message.

    Raw process output:

    *** ERROR ***: Cannot execute /home/$user/.rvm/gems/ruby-2.0.0-p481: Permission denied (13)

    apache log is

    *** ERROR ***: Cannot execute /home/$user/.rvm/gems/ruby-2.0.0-p481: Permission denied (13)
    

    [ 2014-08-07 17:30:51.2870 22171/7f565ebd9700 agents/HelperAgent/RequestHandler.h:2305 ]: [Client 20] Cannot checkout session because a spawning error occurred. The identifier of the error is . Please see earlier logs for details about the error.
    App 24396 stdout:
    App 24396 stderr: *** ERROR ***: Cannot execute /home/$user/.rvm/gems/ruby-2.0.0-p481: Permission denied (13)
    [ 2014-08-07 17:37:23.9061 22171/7f5660d05700 Pool2/Implementation.cpp:284 ]: Could not spawn process for application /opt/redmine/current: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger.
    Error ID: 5811413f
    Error details saved to: /tmp/passenger-error-uIyI8h.html
    Message from application: An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger. Please read this article for more information about this problem.
    Raw process output:

    /etc/apache2/conf-enabled$ cat passenger.conf
    LoadModule passenger_module /home/$user/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.48/buildout/apache2/mod_passenger.so

    PassengerRoot /home/$user/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.48
    PassengerDefaultRuby /home/$user/.rvm/gems/ruby-2.0.0-p481/wrappers/ruby

    Could you have any idea?
    Web application could not be started

    • Martin DENIZET August 9, 2014 9:25 am  Reply

      Hi Han,
      Sorry for the late reply, I was on holidays.
      It seems you followed the Ubuntu article.
      In passenger.conf, replace the $user by the name of your user. $user is a variable, it changes according to which user is calling it.
      Make sure the files actually exist in the specified path.
      Cheers,

  22. Rafael August 8, 2014 6:49 am  Reply

    Hi! I followed all the steps, but when execute service apache2 restart return error:

    Syntax error on line 10 of /etc/apache2/sites-enabled/redmine.vhost:
    SSLProtocol: Illegal protocol ‘TLSv1.2’
    Action ‘configtest’ failed.
    The Apache error log may have more information.
    failed!

    Can u help me?

    • Martin DENIZET August 8, 2014 6:38 pm  Reply

      Hi Rafael,
      Which OS/Version of Apache2 are you using?
      A quick fix would be for you to remove the following lines from redmine.vhost:
      SSLProtocol +TLSv1.2 +TLSv1.1 +TLSv1
      SSLHonorCipherOrder on
      SLCipherSuite "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:AES256-GCM-SHA384:AES256-SHA256:CAMELLIA256-SHA:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:CAMELLIA128-SHA"

      • Rafael September 27, 2014 6:40 am  Reply

        I installed Redmine following all the steps you showed, but now I wanted to get the HTTPS and I’m not getting. What can I be doing wrong?

      • Rafael September 27, 2014 6:43 am  Reply

        Sorry, I expressed myself wrong … I want to REMOVE HTTPS.

        • Martin DENIZET September 29, 2014 5:24 pm  Reply

          Hi Rafael,
          Sorry for the late reply.
          To remove HTTPS, disable the HTTPS redirection with: a2dissite redmine-redirect.vhost
          Then edit: /etc/apache2/sites-available/redmine.vhost:
          Remove: NameVirtualHost *:443
          Remove the SSL configuration:
          SSLEngine on
          SSLProtocol +TLSv1.2 +TLSv1.1 +TLSv1
          SSLCompression off
          SSLHonorCipherOrder on
          SSLCipherSuite "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:AES256-GCM-SHA384:AES256-SHA256:CAMELLIA256-SHA:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:CAMELLIA128-SHA"
          SSLCertificateFile /etc/apache2/ssl/redmine.crt
          SSLCertificateKeyFile /etc/apache2/ssl/redmine.key


          ## Enable Strict Transport: http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
          Header add Strict-Transport-Security "max-age=15768000"

          ## SSL Stapling, more at: https://www.insecure.ws/2013/10/11/ssltls-configuration-for-apache-mod_ssl/
          # SSLUseStapling on
          # SSLStaplingResponderTimeout 5
          # SSLStaplingReturnResponderErrors off
          # SSLStaplingCache shmcb:/var/run/ocsp(128000)

          Edit the VirtualHost listening port such as:

          That should be all,
          Cheers,

  23. Soufraz August 15, 2014 9:20 pm  Reply

    I did the whole process in a test server on my network. The entire process was executed and all errors were corrected. Now I need to access via internal server ip this bar redmine. http://10.0.0.100/redmine
    How could I change the settings in my case?

  24. Melroy August 19, 2014 6:17 am  Reply

    Everything is working just fine Apache v2.4.7 (Ubuntu), however…

    If I go to my repository within Redmine, I can see all the files, but I don’t see any revisions!?

    Clicking on ‘all revisions’ gives me an empty page. By typing: git show, in the terminal gives me a whole list of changes/commits.

    Meaning I do have commits.

    Anybody?

    Kind regards,
    Melroy van den Berg

    • Melroy August 19, 2014 6:27 am  Reply

      Somehow changing the settings at:
      https://my.site.org/settings?tab=repositories

      I checked the box, called: ‘Fetch commits automatically’. Suddenly it just works..

      I also run your crontab command Martin. I hope it’s just working all fine from now :S.

      • Martin DENIZET August 19, 2014 10:11 am  Reply

        Hi Melroy,
        This is an article in my long list of articles I’d like to write when I have time.
        Yes, you need to fetch the changesets for them to appear in Redmine. There is 3 ways people do that:

        1. Fetch with Redmine when browsing. Simple but may cause performance problems with large repos
        2. Crontab. Problem: the changes take some time to appear
        3. Commit Trigger. That’s my favorite, changes are fetched when the server receives code. But it’s a little more complicated to implement.

        Cheers,

    • Martin DENIZET August 26, 2014 7:56 pm  Reply

      Hello Benoit,
      I didn’t test but I assume it should work easily.
      Don’t hesitate to give feedback if you try it 😉
      Cheers,

  25. Paul August 27, 2014 4:14 am  Reply

    Debian 7 – the last service apache2 restart throws an error :

    Syntax error on line 81 of /etc/apache2/sites-enabled/redmine.vhost:
    Can’t locate Apache2/Redmine.pm in @INC (…) at (eval 2) line 2.\n
    Action ‘configtest’ failed.
    The Apache error log may have more information.
    failed!

    Nothing in Apache error log.
    Haven’t got a clue…

    • Martin DENIZET August 27, 2014 10:34 am  Reply

      Hi Paul,
      It seems you missed or had a problem with this command:
      ln -s /opt/redmine/current/extra/svn/Redmine.pm /usr/lib/perl5/Apache2/
      Can you please run it and restart Apache? That should solve the problem.
      Cheers,

      • Paul August 27, 2014 7:54 pm  Reply

        Sorry, yes that was it. Thanks !

      • Martin DENIZET August 27, 2014 9:48 pm  Reply

        Great to hear you got it working! 😀
        Have a nice day!

  26. Tony Vasile November 19, 2014 9:45 am  Reply

    Hi Martin,
    I am getting stuck when I try “bundle exec rake generate_secret_token” . I get the following:

    rake aborted!
    Don’t know how to build task ‘generate_secret_token’

    Any ideas?

    • Martin DENIZET November 19, 2014 5:13 pm  Reply

      Hello Tony,
      You have to be in the Redmine directory (/opt/redmine/current) to run this command.
      Please tell me if it doesn’t solve the problem.
      Cheers 🙂

  27. wcars05 November 25, 2014 5:01 am  Reply

    Hi Martin and everyone. As per a fresh netinstall of Debian 7.7 (32-bit) I had to change the redmine.vhost to reference

    “PerlLoadModule Apache::Redmine” instead of “PerlLoadModule Apache2::Redmine”

    And “PerlAccessHandler Apache::Authn::Redmine::access_handler” instead of “PerlAccessHandler Apache2::Authn::Redmine::access_handler”

    And “PerlAuthenHandler Apache::Authn::Redmine::authen_handler” Instead of “PerlAuthenHandler Apache2::Authn::Redmine::authen_handler”

    For both instances of this in the config options for the site. I also had to symlink to apache instead of apache2 for the perl symlink. After doing this it resolved my “Internal Server Error 500” when accessing svn via webdav.

    Thanks for the tutorial!

    P.S. Figured out by checking the apache2 redmine error logs and finding this:
    http://www.redmine.org/boards/2/topics/42298

    • Martin DENIZET November 30, 2014 3:12 pm  Reply

      Hi,
      Thank you for your feedback. I’ll update that very quickly!
      Cheers,

  28. guillaume November 29, 2014 10:39 pm  Reply

    Hi

    Thanks for this excellent tuto. I was able to install your redmine plugin as well. I can now create a repository for q specific project but how did I clone/commit from a remote machine ?

    I tried to install the Redmine Checkout plugin since it is mentioned in the configuration of the Create Git plugin but it seems that it is not alive anymore and faced errors related to different gems versions.

    Any suggestions?

    Cheers

      • Mauro February 28, 2015 10:41 pm  Reply

        It does not seem to work anymore with apache2.4+redmine3.0.0.
        Error is:
        == 20100426154202 RenameRenderLinkToRenderType: migrating =====================
        — add_column(:repositories, :render_type, :string, {:default=>”url”, :null=>false})
        -> 0.3012s
        rake aborted!
        StandardError: An error has occurred, all later migrations canceled:

        wrong number of arguments (2 for 1)/var/lib/gems/2.1.0/gems/activerecord-4.2.0/lib/active_record/relation.rb:327:in `update_all’
        /var/lib/gems/2.1.0/gems/activerecord-4.2.0/lib/active_record/querying.rb:8:in `update_all’
        /home/redmine/redmine/redmine-3.0.0/plugins/redmine_checkout/db/migrate/20100426154202_rename_render_link_to_render_type.rb:11:in `up’

        Any idea where to find (a working version of) this useful plugin?
        TiA

  29. guillaume December 1, 2014 9:51 pm  Reply

    Bonjour

    Yes indeed I saw your post on the Redmine site and I used the one you mentioned. It seems to work fine but … 😉
    If I create a project in Redmine using create_git plugin then redmine_checkout gives me a URL. When trying to clone from my laptop I nevertheless get this:

    git clone https://myfqdn/git/testgit2.myrepo
    Cloning into ‘testgit2.myrepo’…
    fatal: unable to access ‘https://myfqdn/git/testgit2.myrepo/’: The requested URL returned error: 500

    The error seems to be related to some auth issue as the apache log says:
    [Mon Dec 01 14:39:53 2014] [error] [client A.B.C.D] failed to resolve handler `Apache2::Authn::Redmine::access_handler’: Can’t locate Apache2/Authn/Redmine/access_handler.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl . /etc/apache2) at (eval 17) line 2, line 558.\n

    I have this:
    ls -lrt /usr/lib/perl5/Apache2/Redmine.pm
    lrwxrwxrwx 1 root root 37 sept. 20 16:53 /usr/lib/perl5/Apache2/Redmine.pm -> /scratch/redmine/extra/svn/Redmine.pm

    but /usr/lib/perl5/Apache2/ in not in the @INC

    Am I missing something ? Is that the only error ?

    I am running Apache 2.2.22 on Debian Wheezy
    Cheers

  30. Alex December 19, 2014 6:56 pm  Reply

    Hello!

    Super tuto merci !

    Great HowTo, thanks!

  31. dastanko December 25, 2014 2:19 pm  Reply

    Hi, Martin

    I’m using the plugin you created, but I can’t it get to work with redmine_checkout plugin that you suggested. I’ve cloned the project and made all the instructions given for installation of redmine_checkout plugin but got no success to make it work. After command ‘rake redmine:plugins:migrate RAILS_ENV=production’ for redmine_checkout plugin I sees this error:

    rake aborted!
    LoadError: cannot load such file — redmine_plugin_support
    /opt/redmine/redmine-2.6.0/plugins/redmine_checkout/Rakefile:2:in `require’
    /opt/redmine/redmine-2.6.0/plugins/redmine_checkout/Rakefile:2:in `’
    /home/dastan/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval’
    /home/dastan/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `’
    (See full trace by running task with –trace)

    Even though that I’ve already installed gem ‘redmine_plugin_support’.

    Can you help me with this issue? Any guess, suggestions will be appreciated. Thanks in advance/

  32. eXtide December 29, 2014 6:37 pm  Reply

    Hey, this Guide is great! Just follwed it and everything runs just perfect. You should contribte it to official redmine howtos

  33. Meiko Richert February 26, 2015 9:13 pm  Reply

    Hi Martin, first of all, thank you for this excellent guide! works great!

    However, there is a question: How would you update all the installed components on Debian 7?

    I tried \”gem update\” and after a very long automated update process (which also adds a lot of new gems) , I ended up with a \”Web application could not be started superclass mismatch for class Mark (TypeError)\” on my redmine web frontend.
    I googled this error and found out that I had to perform \”rvm implode\” and redo the rvm install. I did it, and performed all your steps from the beginning, this time

    including \”redmine 2.6-stable current\” in the svn command.
    All installation was running fine and in the end, my server was up & running again with redmine 2.6.2. Hooray!

    BUT: When I run \”gem update\” again, a lot of new gems and updates are installed and again my redmine web frontend is unavailable. I eventually removed the gem \”psych\” and this helped.

    So my general question is, how to avoid this? Is Updating the gems with \”gem update\” not the recommended way?

    Thanks in advance!

    yours,
    meiko

    • Martin DENIZET February 28, 2015 4:28 am  Reply

      Hello Meiko,

      When you update Redmine, a simple bundle install should do.
      The bundler will fetch only gems compatible with the application (Redmine) as defined in the Gemfile.
      You can also instruct the bundler to fetch newer but still compatible gems with bundle update.
      Note that you must be in Redmine’s directory to use the bundler (directory where the Gemfile is located).

      Cheers,

  34. Simmons May 16, 2015 6:40 am  Reply

    This is easily the best redmine tutorial i\’ve found. I wonder if you would be able to give the best way to update to a completely new version of redmine for someone that used this guilde. For example, if I used this guide while 2.5.3 was out, I\’ve seen tons of guides that say just run svn update, then bundle update, but this still tries to 2.5.3. Is running an svn relocate or svn switch to the newest version the best way, or is there an easier method?

    • Martin DENIZET October 27, 2015 3:09 am  Reply

      Hello,
      Thanks for your kind comment. An article about updating Redmine is long overdued.
      To sum up, how I do it is:
      * Backup!
      * svn update for revisions (2.5.1 -> 2.5.2)
      * svn switch http://svn.redmine.org/redmine/branches/3.0-stable for minor/major versions
      * bundle update
      * RAILS_ENV=production bundle exec rake db:migrate
      * service apache2 restart

      Usually, the only problems you should get are with the plugins that may need to be updated.

      I hope it helps

  35. Bright June 9, 2015 3:12 am  Reply

    Hi thanks for this awesome post. Has definitely been a life saver.

    I am trying to add my got repo on the localhost which is chown www-data but keep getting stderr: fatal: Not a git repository.

    Do you know what I might be doing wrong?

  36. Kevin Aurey October 22, 2015 12:57 am  Reply

    Great guide Martin! With you guide, I can install redmine with minimal experience with debian (Not an IT major).

    So… i have some question.
    1. Now, i can access my redmine from local, but only with https://. Can i make it so i can access it without the https? so like only 192.168.1.200 not https://192.168.1.200

    2. I want to incorporate redmine in my local computer to my website with external hosting, any resources i can read to do it @@. I have limited experience with debian, so any resources/search terminology is appreciated!!

    Thank you Martin!

    • Martin DENIZET October 27, 2015 3:01 am  Reply

      Hello Kevin,
      Thanks for the feedback!
      1. To remove SSL support, run:
      a2dissite redmine-redirect
      edit: /etc/apache2/site-enabled/redmine.vhost
      Replace “” by “
      Delete all the lines related to SSL, starting with “SSLEngine on” ending with “SSLStaplingCache”. Dont forget the “Strict-Transport-Security” part.
      Remove the top line “NameVirtualHost *:443”
      Then restart Apache: service apache2 restart
      2. I’m not sure I got it but if you have a dedicated server/VPS running Debian, you could just install it there?

      Cheers,

  37. Etienne November 3, 2015 7:36 pm  Reply

    Incredibly simple guide to reach a clean install. Thanks a lot Martin!

  38. TonyG December 15, 2015 6:10 am  Reply

    Salut martin,

    i\’m facing a trouble on my plesk 12 debian 7 server, i used to have redmine installed on a plesk 9 , and i\’m trying to restore all this on this new server. i copy paste the files i had on the old server to the var/www/vhost/domaine/redmine , i created the database redmine and import the dump, i installed ruby 1.9.1 , gems, passenger_module (it is running), my document root is DocumentRoot \”/var/www/vhosts/domaine/redmine/public\” on httpd.conf , but each time i\’m calling the http://redmine.domaine.fr/ , i have the :

    Forbidden
    You don\’t have permission to access / on this server.

    on the error.log : Directory index forbidden by Options directive

    i did chmod 755 and even 777 on the redmine directory, tried to set it at www-data as user:group or psacln or psasrv (plesk common groups for regular website) … but nothing changes.

    If you a clue or any idea for me, i\’ll be gratefull !

    Merci d\’avance

    ++

    • Martin DENIZET December 16, 2015 12:18 am  Reply

      Hello Tony,
      Maybe you are missing a statement such as

      Allow from all

      You might want to scan you config for a Deny statement.
      Also, could there be a .htaccess somewhere?
      I suggest you try posting on the Redmine forum at https://redmine.org/projects/redmine/boards
      There might be people with Plesk experience there.
      Cheers,
      -Martin

  39. thellffparis January 12, 2016 7:00 pm  Reply

    Hi Martin,
    Did you try the new 3.2.0 version ?
    Do you think it\’s possible to upgrade directly from 2.5.1 using you last recommendations ?
    \”To sum up, how I do it is:
    * Backup!
    * svn update for revisions (2.5.1 -> 2.5.2)
    * svn switch http://svn.redmine.org/redmine/branches/3.0-stable for minor/major versions
    * bundle update
    * RAILS_ENV=production bundle exec rake db:migrate
    * service apache2 restart\”

    • Martin DENIZET April 19, 2016 5:16 am  Reply

      Very late but yes, I did several updates like that. I didn’t experience a problem that I remember of except plugin compatibility.
      Cheers!

Leave a Reply