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

Yannick Warnier, 2012-09-26 02:12

1 1 Yannick Warnier
h1. HowTo Install Redmine 210 on Debian Squeeze with Apache Passanger
2 1 Yannick Warnier
3 1 Yannick Warnier
_This manual was originally posted here: http://beeznest.wordpress.com/2012/09/20/installing-redmine-2-1-on-debian-squeeze-with-apache-modpassenger/_
4 1 Yannick Warnier
5 1 Yannick Warnier
This article is co-authored by Jérôme Warnier, from work mostly done by him with my occasional support. Kudos go to him.
6 1 Yannick Warnier
7 1 Yannick Warnier
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...
8 1 Yannick Warnier
9 1 Yannick Warnier
h2. Assumptions
10 1 Yannick Warnier
11 1 Yannick Warnier
We take as given that:
12 1 Yannick Warnier
13 1 Yannick Warnier
* We are using a Debian Squeeze installation
14 1 Yannick Warnier
*  We have root access to this machine
15 1 Yannick Warnier
* There is public access to the machine itself (public IP)
16 1 Yannick Warnier
* We are able to define a public domain (or subdomain) name for this Redmine installation
17 1 Yannick Warnier
* 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
18 1 Yannick Warnier
* We will be using Apache 2's modPassenger (and Apache 2 is already installed on the server)
19 1 Yannick Warnier
* We will be using redmine.example.com; so every time you see this below, replace it by your own domain
20 1 Yannick Warnier
21 1 Yannick Warnier
h2. Warming up
22 1 Yannick Warnier
23 1 Yannick Warnier
We will first need to install basic packages:
24 1 Yannick Warnier
<pre>
25 1 Yannick Warnier
apt-get install ruby rubygems libruby libapache2-mod-passenger
26 1 Yannick Warnier
</pre>
27 1 Yannick Warnier
Download the latest version of Redmine (2.1.0 in our case) and untar it, then move it to /usr/local/share
28 1 Yannick Warnier
<pre>
29 1 Yannick Warnier
ln /usr/local/share/redmine-2.1.0 /usr/local/share/redmine
30 1 Yannick Warnier
chown -R root:root /usr/local/share/redmine-2.1.0
31 1 Yannick Warnier
</pre>
32 1 Yannick Warnier
33 1 Yannick Warnier
Install development libraries for MySQL:
34 1 Yannick Warnier
<pre>
35 1 Yannick Warnier
apt-get install libmysqlclient-dev
36 1 Yannick Warnier
</pre>
37 1 Yannick Warnier
38 1 Yannick Warnier
Install development libs for Imagick:
39 1 Yannick Warnier
<pre>
40 1 Yannick Warnier
apt-get install libmagickcore-dev libmagickwand-dev (install shitload of packages)
41 1 Yannick Warnier
</pre>
42 1 Yannick Warnier
43 1 Yannick Warnier
h2. Running the Gem stuff
44 1 Yannick Warnier
45 1 Yannick Warnier
Install Bundler (removing useless module, which would otherwise create dependencies):
46 1 Yannick Warnier
<pre>
47 1 Yannick Warnier
gem install bundler
48 1 Yannick Warnier
cd /usr/local/share/redmine/
49 1 Yannick Warnier
/var/lib/gems/1.8/bin/bundle install --without development test postgresql sqlite
50 1 Yannick Warnier
</pre>
51 1 Yannick Warnier
52 1 Yannick Warnier
h2. Configuration
53 1 Yannick Warnier
54 1 Yannick Warnier
Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.
55 1 Yannick Warnier
Example for a MySQL database using ruby1.8 or jruby:
56 1 Yannick Warnier
<pre>
57 1 Yannick Warnier
production:
58 1 Yannick Warnier
  adapter: mysql
59 1 Yannick Warnier
  database: redmine
60 1 Yannick Warnier
  host: localhost
61 1 Yannick Warnier
  username: redmine
62 1 Yannick Warnier
  password: my_password
63 1 Yannick Warnier
</pre>
64 1 Yannick Warnier
65 1 Yannick Warnier
Generate a session store secret:
66 1 Yannick Warnier
<pre>
67 1 Yannick Warnier
/var/lib/gems/1.8/bin/rake generate_secret_token
68 1 Yannick Warnier
</pre>
69 1 Yannick Warnier
70 1 Yannick Warnier
Generate the database structure:
71 1 Yannick Warnier
<pre>
72 1 Yannick Warnier
RAILS_ENV=production /var/lib/gems/1.8/bin/rake db:migrate
73 1 Yannick Warnier
</pre>
74 1 Yannick Warnier
75 1 Yannick Warnier
Generate default configuration data:
76 1 Yannick Warnier
<pre>
77 1 Yannick Warnier
RAILS_ENV=production /var/lib/gems/1.8/bin/rake redmine:load_default_data
78 1 Yannick Warnier
</pre>
79 1 Yannick Warnier
(using “es” for Spanish language in terminal prompt)
80 1 Yannick Warnier
81 1 Yannick Warnier
Setup config file in config/configuration.yml
82 1 Yannick Warnier
83 1 Yannick Warnier
Change database_ciphr_key: *******
84 1 Yannick Warnier
<pre>
85 1 Yannick Warnier
/var/lib/gems/1.8/bin/rake db:encrypt RAILS_ENV=production
86 1 Yannick Warnier
</pre>
87 1 Yannick Warnier
88 1 Yannick Warnier
h2. Apache
89 1 Yannick Warnier
90 1 Yannick Warnier
Setup Apache’s VirtualHost config
91 1 Yannick Warnier
92 1 Yannick Warnier
<pre>
93 1 Yannick Warnier
# 8080 in this case is because we use a reverse proxy before Apache. Otherwise simply use "*:80"
94 1 Yannick Warnier
95 1 Yannick Warnier
<VirtualHost *:8080>
96 1 Yannick Warnier
 ServerName redmine.example.com
97 1 Yannick Warnier
 DocumentRoot /usr/local/share/redmine/public
98 1 Yannick Warnier
 <Directory /usr/local/share/redmine/public>
99 1 Yannick Warnier
   AllowOverride all
100 1 Yannick Warnier
   Options -MultiViews
101 1 Yannick Warnier
 </Directory>
102 1 Yannick Warnier
</VirtualHost>
103 1 Yannick Warnier
</pre>
104 1 Yannick Warnier
105 1 Yannick Warnier
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.
106 1 Yannick Warnier
107 1 Yannick Warnier
The default login/password is admin/admin (don't forget to change this).
108 1 Yannick Warnier
109 1 Yannick Warnier
h2. Sources of inspiration
110 1 Yannick Warnier
111 1 Yannick Warnier
We used the following resources as a starting point. Thanks to their respective authors.
112 1 Yannick Warnier
113 1 Yannick Warnier
* http://madpropellerhead.com/random/20100820-installing-redmine-on-debian-with-apache (outdated, for Lenny)
114 1 Yannick Warnier
* http://www.redmine.org/projects/redmine/wiki/RedmineInstall
115 1 Yannick Warnier
* http://hodza.net/2012/03/15/howto-install-redmine-on-debian-6-squeeze-ruby-on-rails-apache2-passenger/
116 1 Yannick Warnier
* http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Debian_with_Ruby-on-Rails_and_Apache2-Passenger