30 minutes to Redmine, an express installation guide

Update 2014-10-10:

Updated to install Ruby 2.1.3 (supported from Redmine 2.5.2). Corrects Apache configuration URLs.

Update 2014-07-12:

Added troubleshooting suggestions.

Update 2014-05-20:

Added support for HSTS and commented OCSP stapling.

Before starting

This is an express guide. Novices may need more detailed explanations
For Ubuntu 14.04 instructions 

Most of the time you will be waiting for downloads or compilations to complete.

This was tested on Debian 7.4 (Wheezy) with Redmine 2.5.x but it should be compatible with future updates. You will need a minimum of 512MB of RAM to compile everything needed though 1GB of RAM is recommended.

Note that the total installation time will mostly depend on your internet connection speed.

If your internet is slow, grab a cup of coffee

apt-get update
apt-get install curl gawk g++ gcc make libc6-dev libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev \
sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev git subversion imagemagick \
libmagickwand-dev mysql-server libmysqlclient-dev apache2 apache2-threaded-dev libcurl4-gnutls-dev apache2 \
libapache2-svn libapache-dbi-perl libapache2-mod-perl2 libdbd-mysql-perl libauthen-simple-ldap-perl openssl

Create the database :

Note that ‘my_password’ needs to be replaced by a strong password!
 mysql -uroot -p
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;

Do the stuff! Get Ruby and Redmine:

curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.3
cd /opt/
mkdir redmine
cd redmine/
svn co http://svn.redmine.org/redmine/branches/2.5-stable current
cd current/
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
mkdir -p /opt/redmine/repos/svn /opt/redmine/repos/git
chown -R www-data:www-data /opt/redmine/repos

Here you have some work:

cp config/configuration.yml.example config/configuration.yml
cp config/database.yml.example config/database.yml
nano config/database.yml #Use another editor if you prefer

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.

We can now initialize the Redmine database:

su - # Needed to have access to the bundler, alternatively, you can relog
cd /opt/redmine/current
bundle install --without development test
bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data

We need a web server!

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. Copy the configuration prompted by the command into /etc/apache2/conf.d/passenger.conf. 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/

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

Now we get Apache2 configuration files from a Gist I created

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

You can download the files directly on the server:

cd /etc/apache2/sites-available
wget https://gist.github.com/martin-denizet/11080033/raw/46d6da9217aa249eda8d0203102380e1ba62f774/redmine.vhost
wget https://gist.github.com/martin-denizet/11080033/raw/8cc96e73a43d9ff65b855c9dc1b81c05897ab7fc/redmine-redirect.vhost
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

Note that Perfect Forward Secrecy is configured
a2enmod ssl
a2enmod perl
a2enmod dav
a2enmod dav_svn
a2enmod dav_fs
a2enmod rewrite
a2enmod headers
a2dissite default
a2ensite redmine.vhost
a2ensite redmine-redirect.vhost
service apache2 restart

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

 

46 Comments

  1. lkuulu April 22, 2014 3:53 pm  Reply

    Hi,

    From scratch,
    “bundler” have to be installed before use 🙂
    so I added bundler to the very longest install list.

    nice guide.

    • Martin DENIZET April 22, 2014 4:04 pm  Reply

      Hello,
      Actually the bundler gets installed by RVM (See detail here: http://rvm.io/integration/bundler)
      The problem is that you need to relog the current user to be able to use the bundle commands.
      That’s why I do a su - before using the bundle command (it opens a new shell reloading the user profile).
      I’d like to know if the su - didn’t allow you to get access to the bundle command. I’d need to understand why.
      Thanks for the feedback!

  2. Jakub May 2, 2014 6:59 pm  Reply

    This is instruction for apache 2.2 or 2.4?

    • Martin DENIZET May 2, 2014 9:19 pm  Reply

      Hello Jakub,
      This guide was written using Debian stable (Wheezy, version 7). In Wheezy the Apache package contains Apache2.2.22 as time of writting:

      # apache2 -v
      Server version: Apache/2.2.22 (Debian)
      Server built: Jan 31 2014 18:55:41

      It limits the SSL ciphers available if it’s what you had in mind.
      Cheers!

  3. David Sienniak May 9, 2014 8:22 am  Reply

    Hi Martin,
    Your excellent guide works perfectly on Ubuntu 12.04.
    Even a newbie to Linux like myself could follow it! Thank you. I installed your “Create Git plugin” and that works too.
    I did notice that while I can clone from the repo, I cannot push. Permissions for the git repo are:
    drwxr-sr-x www-data www-data
    If I do a chmod -R g+rwX . then I can push. Is this the right way to enable pushing or am I doing something wrong?
    Regards, David

  4. Dimka June 4, 2014 10:38 pm  Reply

    Hi, Martin.
    Your guide is excellent and works good. My Redmine now works and filled various tasks.
    Did you try this installation with Nginx instead of Apache?
    OR
    Is it posible to modify this complete installation by adding Nginx as reserve proxy?

    • Martin DENIZET June 6, 2014 1:11 pm  Reply

      Hi Dimka,
      I tried Puma installation with Nginx for “fun” but I didn’t have GIt and SVN integration working that’s why I didn’t write about it.
      It should work to use Nginx as reverse proxy for the configuration in this article. For reference, the Nginx documentation: http://nginx.com/resources/admin-guide/reverse-proxy/
      If you move Redmine to use only port 8080 on localhost, you could do:

      location / {
      proxy_pass http://localhost:8080/
      }

      Don’t forget to get SSL configured.
      I’ll be looking forward knowing what worked for you.
      Cheer,

  5. Hossein July 14, 2014 2:05 am  Reply

    I want to run and test Redmine on localhost.
    What changes do I have to make in redmine.vhost and redmine-redirect.vhost exactly?

    • Martin DENIZET July 14, 2014 10:49 am  Reply

      Hi Hossein,
      To have Redmine accessible on the local computer only, you should replace:
      VirtualHost *:80 by VirtualHost localhost:80 in redmine-redirect.vhost
      VirtualHost *:443 by VirtualHost localhost:443 in redmine.vhost
      If it’s not successful, you can try with 127.0.0.1 instead of localhost.
      Alternatively , you could also implement a Allow/Deny statement to allow only access from localhost.
      Let me know how it goes.

  6. Eric July 18, 2014 6:06 pm  Reply

    Hi,

    I installed as described, but when I close the Firefox browser or tab and try to login again I can’t get to my/home. It looks like the browser keeps the cookies of the previous session. How can I remove the cokkies when I close the browser/browser tab. Does anyone experienced this before?

    • Martin DENIZET July 19, 2014 5:47 pm  Reply

      Hi Eric,
      Yes, this is the expected behavior.
      You can adjust it in: Administration/Settings/Authentication tab:
      You can set “Session maximum lifetime” and “Session inactivity timeout”, they are both disabled by default.
      Cheers,

      • Eric July 19, 2014 10:26 pm  Reply

        I have set the following:

        Session maximum lifetime: 1 day
        Session inactivity timeout : 1hour

        But this does not solve the problem, after closing the browser/ browser tab I get the following error:

        The page isn’t redirecting properly

        Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

        This problem can sometimes be caused by disabling or refusing to accept cookies.

        • Martin DENIZET July 20, 2014 12:14 am  Reply

          Hey Eric,
          Are you using SSL or not? If not, get rid of the HSTS instructions. You could also try to disable the redmine-redirect to see how it affects the behavior.
          I wont be available for the next 2 weeks.
          Post here if you find the solution to your problem please.
          Cheers

  7. Eric July 19, 2014 10:38 pm  Reply

    In addition, If I remove the browser cookies after closing the browser/browser tab it works fine

  8. Melroy August 10, 2014 9:06 am  Reply

    Thanks!

    • Martin DENIZET August 13, 2014 12:27 pm  Reply

      Glad it was helpful! It’s always nice to have feedback!

  9. estu August 13, 2014 12:18 pm  Reply

    hai,
    i just try install redmine in debian wheezy.
    who owner of directory /opt/redmine
    in my server it belong to root . 🙁
    thanks

    • Martin DENIZET August 13, 2014 12:26 pm  Reply

      Hello Estu,
      On my installation too, root is the owner of /opt/redmine
      That should not be a problem.
      Do you have permissions issues?
      Cheers,

  10. estu August 13, 2014 3:39 pm  Reply

    yes.
    maybe i should try reinstall again.
    i just want set repos dir to /home/git (separated).
    🙂

    thanks for replay. 😀

    • Martin DENIZET August 13, 2014 3:46 pm  Reply

      Hi Estu,
      No need to re-install to do so. You can do it just by modifying the path to repositories in the /git location in the Apache configuration.
      Cheers,

      • estu August 13, 2014 6:27 pm  Reply

        its done,
        i reinstalled redmine,
        need change group permission to repos dir.
        *maybe i should write in my blog.
        thanks. it actually help me.. 😀

  11. Nick August 19, 2014 3:21 pm  Reply

    Hi Martin

    Thanks for this great tutorial!
    Did you have success in the meantime to get GitSmartHTTP to work with Ubuntu 14.04 and Redmine 2.5.x?

    Regards

  12. Sofie January 12, 2015 10:47 am  Reply

    Thanks a lot for this!
    Especially as Debian packages are outdated and configuration files containing deprecated Gem.source_index.
    I would send you a Flattr or micropayment, if you had any, by now just big thanx.

    • Martin DENIZET January 12, 2015 4:51 pm  Reply

      Thank you very much Sofie, it means a lot!
      I’ll think about it for the Flattr 😉
      Cheers,

  13. volkswagner February 5, 2015 10:12 am  Reply

    I get command not found when running bundle install –without development test

  14. volkswagner February 5, 2015 10:19 am  Reply

    I didn\’t realize I had to run again \”curl -sSL https://get.rvm.io | bash -s stable –ruby=2.1.3\”

    after I go gpg error:

    gpg: Can\’t check signature: public key not found
    try downloading the signatures:

    Question is, do you install .rvm into /root as root user or do you install into your user\’s /home/username directory?

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

      Hello,

      Yes, indeed there was a change in the installation process of RVM, my tutorial needs to be updated.
      I install RVM as root for more convenience and to simplify the instructions.
      If you don’t install as root, you would have to “source” RVM before using it.

      Sorry for the late reply, I got busy with work!

      Cheers,

  15. Mauro February 25, 2015 11:24 pm  Reply

    I\’m following Your guide to install brand new 3.0.0 in a very strange environment (debian jessie running in a chroot jail) and, as expected, I ran into problems 😉

    1) it is advised upstream to use Bundle to install gems, so I did:

    echo >Gemfile.local \”gem \’passenger\’\”
    bundle install

    2) I elected to install in another dir, so I did:

    cd /my/non-standard/location
    ln -s redmine-3.0.0 current
    ln -s /my/non-standard/location /opt/redmine

    3) perl5 @INC seems different, so Your symlink became:

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

    4) my apache2 installation doesn\’t seem to recognize .vhost extension, so I renamed .conf

    5) apache 2.4 config syntax seems a bit changed; I got errors:
    [warn] The apache2 configtest failed. … (warning).
    Output of config test was:
    AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/redmine.conf:1
    AH00526: Syntax error on line 73 of /etc/apache2/sites-enabled/redmine.conf:
    Either all Options must start with + or -, or no Option may.
    Action \’configtest\’ failed.

    6) I also have another web server (non chroot-ed) running, so I had to change the default ports (56180 & 56443, if matters).

    All this is somewhat ok, I report it just to let You upgrade Your (already very good) post.
    Unfortunately I get a: \”Forbidden – You don\’t have permission to access / on this server.\”

    apache2/redmine.error.log says:
    [Wed Feb 25 15:13:28.540371 2015] [authz_core:error] [pid 18146:tid 4051663680] [client 192.168.7.124:20711] AH01630: client denied by server configuration: /opt/redmine/current/public/

    Any suggestion? TiA

  16. IB February 20, 2016 12:13 am  Reply

    Hi, How can i disable https, i want to use http only. Thanks.

    • Martin DENIZET February 20, 2016 5:42 am  Reply

      Hello,

      Disable the redirection:
      a2dissite redmine-redirect.vhost
      Then edit: /etc/apache2/sites-available/redmine.vhost

      Change the VirtualHost *:443 to VirtualHost *:80
      Then remove the few lines for SSL configuration.
      Restart apache2:
      service apache2 restart

      You should be good!

      Cheers,

  17. Dionis June 25, 2016 8:39 pm  Reply

    Hello Can you help me with instructions?

    When i type \”sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev git subversion imagemagick \\\” it show me this
    \”>
    bash: sqlite3: command not found\”

    Then when i type \”libmagickwand-dev mysql-server libmysqlclient-dev apache2 apache2-threaded-dev libcurl4-gnutls-dev apache2 \\\” it show me

    \”>
    bash: libmagickwand-dev: command not found\”

    Can you say me what is this? i have new installed Debian 8

    • Martin DENIZET June 26, 2016 2:08 am  Reply

      Hello Dionis,

      Copy/paste this entire block in one go:
      apt-get install curl gawk g++ gcc make libc6-dev libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev \
      sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev git subversion imagemagick \
      libmagickwand-dev mysql-server libmysqlclient-dev apache2 apache2-threaded-dev libcurl4-gnutls-dev apache2 \
      libapache2-svn libapache-dbi-perl libapache2-mod-perl2 libdbd-mysql-perl libauthen-simple-ldap-perl openssl

      The \ at the end of the lines tell Linux that the command is not complete and that it continues on the next line.

      This could be actually a single line but it kind of break my blog’s layout if I make a line that long.

      Cheers,

  18. IB July 26, 2017 9:48 pm  Reply

    Hi,
    How do i update the setup above from redmine 3,2 to redmine 3,4 (the most recent stable version) ?
    Thanks !

Leave a Reply