Project

General

Profile

HowTo Install Redmine on Debian 8 with Apache2-Passenger » History » Version 14

Eric dLR, 2016-11-13 13:21
Correcting a typo in the 'Install Debian Packages' header.

1 1 Dirk Abe
h1. HowTo Install Redmine on Debian 8 with Apache2-Passenger
2
3 3 Dirk Abe
Last updated: 4. April 2015
4 1 Dirk Abe
5 7 Dirk Abe
This HowTo describes installing redmine 3.0.1 on Debain 8 (April 15, few weeks before released as
6 1 Dirk Abe
stable) with Apache and MySQL. 
7
8
*Hint:*
9 13 Felipe Braga
Run all commands as normal user. If root privileges required i used sudo (the 'sudo' package needs to be properly instaled and configured).
10 1 Dirk Abe
11 14 Eric dLR
h2. 1. Install Debian Packages
12 1 Dirk Abe
13
<pre>
14 11 Mike Zabala
sudo aptitude install mysql-server mysql-client libmysqlclient-dev gcc build-essential zlib1g zlib1g-dev zlibc ruby-zip libssl-dev libyaml-dev libcurl4-openssl-dev ruby gem libapache2-mod-passenger apache2-mpm-prefork apache2-dev libapr1-dev libxslt1-dev checkinstall libxml2-dev ruby-dev vim libmagickwand-dev imagemagick
15 1 Dirk Abe
</pre>
16
17
18
h2. 2. Download and prepare Redmine
19
20
h3. 2.1 Download Redmine
21
22
<pre>
23
cd /opt/
24
sudo mkdir redmine
25
sudo chown -R $your_user redmine
26
cd redmine
27
wget $redmine.tar.gz
28
tar xzf $redmine.tar.gz
29
cd redmine-X.X.X
30
</pre>
31
32
33
h3. 2.2 Prepare MySQL 
34
35
<pre>
36
mysql --user=root --password=$password
37
</pre>
38
39
40
<pre>
41
CREATE DATABASE redmine CHARACTER SET utf8;
42
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
43
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
44
exit
45
</pre>
46
47
Redmine DB-Config:
48
49
<pre>
50
cp config/database.yml.example config/database.yml
51
</pre>
52
53
customize config/database.yml:
54
55
<pre>
56
production:
57 9 Greg Stevenson
  adapter: mysql2
58 1 Dirk Abe
  database: redmine
59
  host: localhost
60
  username: redmine
61
  password: my_password
62
</pre>
63
64
h3. 2.3 Bundler
65
66
install bundler: 
67
68
<pre>
69
sudo gem install bundler
70 11 Mike Zabala
bundle install --without development test
71 1 Dirk Abe
</pre>
72
73
generate secret token:
74
75
<pre>
76
bundle exec rake generate_secret_token
77
</pre>
78
79
prepare DB and install all tables:
80
81
<pre>
82
RAILS_ENV=production bundle exec rake db:migrate
83
RAILS_ENV=production bundle exec rake redmine:load_default_data
84
</pre>
85
86 2 Dirk Abe
h3. 2.4 Test Redmine
87 1 Dirk Abe
88
replace $IP with your external IP:
89
<pre>
90
bundle exec ruby bin/rails server -b $IP webrick -e production
91
</pre>
92
93
Open your browser and visit http://$IP:3000
94
95 2 Dirk Abe
h2. 3 Apache
96 1 Dirk Abe
97
The apache service runs with the user www-data, so www-data needs access to some dirs:
98
99
<pre>
100
sudo chown -R www-data files log tmp public/plugin_assets
101
sudo chmod -R 755 files log tmp public/plugin_assets
102 12 Raúl Priego
sudo chown www-data:www-data Gemfile.lock
103 1 Dirk Abe
</pre>
104
105
Link the redmine public dir to the apache root:
106
107
<pre>
108 10 Greg Stevenson
sudo ln -s /opt/redmine/redmine-X.X.X/public/ /var/www/html/redmine
109 1 Dirk Abe
</pre>
110
111
The following VirtualHost config requieres control over your webserver.
112
Every Site under /var/www/html/ needs maybe an Location-directive.
113
114
We generate a new vhost config:
115
<pre>
116
sudo vim /etc/apache2/sites-available/master.conf
117
</pre>
118
119
and for redmine you need:
120
121
<pre>
122
<VirtualHost *:80>
123
124
ServerAdmin admin@example.com
125
Servername hostname
126
DocumentRoot /var/www/html/
127
128
        <Location /redmine>
129
                RailsEnv production
130
                RackBaseURI /redmine
131
                Options -MultiViews
132
        </Location>
133
134
</VirtualHost>
135
</pre>
136
137
Disable debians default-vhost:
138
<pre>
139
sudo a2dissite 000-default.conf
140
</pre>
141
142
and enable the new master vhost:
143
<pre>
144
sudo a2ensite master.conf
145
</pre>
146
147 3 Dirk Abe
To avoid permission error the passenger mod needs to run also as www-data.
148
Edit /etc/apache2/mods-available/passenger.conf and add this line:
149 1 Dirk Abe
<pre>
150 3 Dirk Abe
PassengerUser www-data
151 4 Dirk Abe
</pre>
152 3 Dirk Abe
153
after all restart apache:
154
<pre>
155
sudo service apache2 restart
156 1 Dirk Abe
</pre>
157
158
Open your browser and visit http://$IP/redmine
159
Finish.