HowTo Install Redmine 210 on Debian Squeeze with Apache Passanger » History » Version 2

Version 1 (Yannick Warnier, 2012-09-26 02:12) → Version 2/3 (Yannick Warnier, 2012-09-26 09:48)

h1. HowTo Install Redmine 210 on Debian Squeeze with Apache Passenger Passanger

_This manual was originally posted here: http://beeznest.wordpress.com/2012/09/20/installing-redmine-2-1-on-debian-squeeze-with-apache-modpassenger/_

This article is co-authored by Jérôme Warnier, from work mostly done by him with my occasional support. Kudos go to him.

We couldn't find any valuable manual to install Redmine 2.1 on Debian Squeeze, and we sure met a lot of resistance along the way, so we came up with the following step-by-step guide...

h2. Assumptions

We take as given that:

* We are using a Debian Squeeze installation
* We have root access to this machine
* There is public access to the machine itself (public IP)
* We are able to define a public domain (or subdomain) name for this Redmine installation
* We have access to define a database (we chose MySQL) user for Redmine (this is important to avoid security risks in sharing accounts with another web system). We also assume that we already have a MySQL server installation
* We will be using Apache 2's modPassenger (and Apache 2 is already installed on the server)
* We will be using redmine.example.com; so every time you see this below, replace it by your own domain

h2. Warming up

We will first need to install basic packages:
<pre>
apt-get install ruby rubygems libruby libapache2-mod-passenger
</pre>
Download the latest version of Redmine (2.1.0 in our case) and untar it, then move it to /usr/local/share
<pre>
ln /usr/local/share/redmine-2.1.0 /usr/local/share/redmine
chown -R root:root /usr/local/share/redmine-2.1.0
</pre>

Install development libraries for MySQL:
<pre>
apt-get install libmysqlclient-dev
</pre>

Install development libs for Imagick:
<pre>
apt-get install libmagickcore-dev libmagickwand-dev (install shitload of packages)
</pre>

h2. Running the Gem stuff

Install Bundler (removing useless module, which would otherwise create dependencies):
<pre>
gem install bundler
cd /usr/local/share/redmine/
/var/lib/gems/1.8/bin/bundle install --without development test postgresql sqlite
</pre>

h2. Configuration

Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.
Example for a MySQL database using ruby1.8 or jruby:
<pre>
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password
</pre>

Generate a session store secret:
<pre>
/var/lib/gems/1.8/bin/rake generate_secret_token
</pre>

Generate the database structure:
<pre>
RAILS_ENV=production /var/lib/gems/1.8/bin/rake db:migrate
</pre>

Generate default configuration data:
<pre>
RAILS_ENV=production /var/lib/gems/1.8/bin/rake redmine:load_default_data
</pre>
(using “es” for Spanish language in terminal prompt)

Setup config file in config/configuration.yml

Change database_ciphr_key: *******
<pre>
/var/lib/gems/1.8/bin/rake db:encrypt RAILS_ENV=production
</pre>

h2. Apache

Setup Apache’s VirtualHost config

<pre>
# 8080 in this case is because we use a reverse proxy before Apache. Otherwise simply use "*:80"

<VirtualHost *:8080>
ServerName redmine.example.com
DocumentRoot /usr/local/share/redmine/public
<Directory /usr/local/share/redmine/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
</pre>

Once you enable this virtual host (a2ensite redmine.example.com) and reload Apache (/etc/init.d/apache2/reload), you should see your site running on http://redmine.example.com.

The default login/password is admin/admin (don't forget to change this).

h2. Sources of inspiration

We used the following resources as a starting point. Thanks to their respective authors.

* http://madpropellerhead.com/random/20100820-installing-redmine-on-debian-with-apache (outdated, for Lenny)
* http://www.redmine.org/projects/redmine/wiki/RedmineInstall
* http://hodza.net/2012/03/15/howto-install-redmine-on-debian-6-squeeze-ruby-on-rails-apache2-passenger/
* http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Debian_with_Ruby-on-Rails_and_Apache2-Passenger