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
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 :
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.
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
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 also need to replace redmine.domain.com by your domain name in both files
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
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
Hi,
From scratch,
“bundler” have to be installed before use 🙂
so I added bundler to the very longest install list.
nice guide.
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!
This is instruction for apache 2.2 or 2.4?
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:
It limits the SSL ciphers available if it’s what you had in mind.
Cheers!
Thanks for your answer. I’ve asked, because I have problem with Apache 2.4 actually. I was hoping it is tutorial for 2.4. (Till now I wasn’t able to run it).
I saw your post on the Redmine forum, I replied there.
I hope it helps, cheers!
I hope you can include the answer here too. I am having the same issue. I can’t get it to run on Apache 2.4
The post on Redmine forum is: http://www.redmine.org/boards/2/topics/42336
Jakub didn’t set properly his PassengerAppRoot.
Redmine works on Apache 2.4 ( https://martin-denizet.com/install-redmine-2-5-x-git-subversion-ubuntu-14-04-apache2-rvm-passenger/ ).
However Redmine.pm (HTTP(S) authentication for repositories) needs a hack.
Do you have any specifics about your error?
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
Hi David,
I tried with Ubuntu 14.04 (https://martin-denizet.com/install-redmine-2-5-x-git-subversion-ubuntu-14-04-apache2-rvm-passenger/) but I could not get Git to work over HTTP.
I guess your fix is valid, just I could not test it.
Cheers
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?
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,
I want to run and test Redmine on localhost.
What changes do I have to make in redmine.vhost and redmine-redirect.vhost exactly?
Hi Hossein,
To have Redmine accessible on the local computer only, you should replace:
VirtualHost *:80
byVirtualHost localhost:80
in redmine-redirect.vhostVirtualHost *:443
byVirtualHost localhost:443
in redmine.vhostIf 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.
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?
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,
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.
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
In addition, If I remove the browser cookies after closing the browser/browser tab it works fine
Thanks!
Glad it was helpful! It’s always nice to have feedback!
hai,
i just try install redmine in debian wheezy.
who owner of directory /opt/redmine
in my server it belong to root . 🙁
thanks
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,
yes.
maybe i should try reinstall again.
i just want set repos dir to /home/git (separated).
🙂
thanks for replay. 😀
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,
its done,
i reinstalled redmine,
need change group permission to repos dir.
*maybe i should write in my blog.
thanks. it actually help me.. 😀
Pingback: Memasang Redmine+Integrasi Git di Debian Wheezy | Perjalanan Tuan Pembual Kepulau Ketiga
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
Hi Nick,
It seems there is no progress on the issue: http://www.redmine.org/issues/16948
But there is a patch that works great. Use only if you don’t need anonymous access to the repo.
Patch: http://stackoverflow.com/questions/22638972/debug-apache-2-4-perlauthenhandler
Cheers,
Pingback: Redmine mit Apache und Git auf CentOS 7 Eine Odyssee
Excellent guide! Works perfectly! Works with Redmine 2.6 too.
svn co http://svn.redmine.org/redmine/branches/2.6-stable current
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.
Thank you very much Sofie, it means a lot!
I’ll think about it for the Flattr 😉
Cheers,
I get command not found when running bundle install –without development test
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?
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,
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
Replying to myself:
This is another 2.2 -> 2.4 change.
Access control is different, see: http://httpd.apache.org/docs/2.4/upgrading.html#access
Hello Mauro,
Sorry for the late reply, I’ve been busy.
Glad you could figure it out.
For the record my instructions for Ubuntu 14.04 include Apache configuration for Apache version 2.4+.
Available there: https://martin-denizet.com/install-redmine-2-5-x-git-subversion-ubuntu-14-04-apache2-rvm-passenger/
Cheers,
I’m looking at it right now, it looks quite different, at least the Apache config.
Problem I have now is I am unable to access the repository using git clone/push https://…
I opened a question on serverfault (http://serverfault.com/questions/671472/apache-2-4-git-integration) where I detail the error; it boils down to being unable to make git-http-backend to work (actually I’m unsure it is called at all!).
If You could help… 😉
TiA
Mauro
Hi, How can i disable https, i want to use http only. Thanks.
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,
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
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,
Pingback: Redmine auf CentOS 7 mit Git und Apache Eine Odyssee - FrankTheDevop
Hi,
How do i update the setup above from redmine 3,2 to redmine 3,4 (the most recent stable version) ?
Thanks !