Project

General

Profile

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

Greg Stevenson, 2015-06-04 01:29

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
Run all commands as normal user. If root privileges required i used sudo.
10
11
h2. 1. Install Debain Packages
12
13
<pre>
14 8 Greg Stevenson
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
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
  adapter: mysql
58
  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
bundle install --without development test rmagick
71
</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
</pre>
103
104
Link the redmine public dir to the apache root:
105
106
<pre>
107
sudo ln -s /opt/redmine/redmine-3.0.1/public/ /var/www/html/redmine
108
</pre>
109
110
The following VirtualHost config requieres control over your webserver.
111
Every Site under /var/www/html/ needs maybe an Location-directive.
112
113
We generate a new vhost config:
114
<pre>
115
sudo vim /etc/apache2/sites-available/master.conf
116
</pre>
117
118
and for redmine you need:
119
120
<pre>
121
<VirtualHost *:80>
122
123
ServerAdmin admin@example.com
124
Servername hostname
125
DocumentRoot /var/www/html/
126
127
        <Location /redmine>
128
                RailsEnv production
129
                RackBaseURI /redmine
130
                Options -MultiViews
131
        </Location>
132
133
</VirtualHost>
134
</pre>
135
136
Disable debians default-vhost:
137
<pre>
138
sudo a2dissite 000-default.conf
139
</pre>
140
141
and enable the new master vhost:
142
<pre>
143
sudo a2ensite master.conf
144
</pre>
145
146 3 Dirk Abe
To avoid permission error the passenger mod needs to run also as www-data.
147
Edit /etc/apache2/mods-available/passenger.conf and add this line:
148 1 Dirk Abe
<pre>
149 3 Dirk Abe
PassengerUser www-data
150 4 Dirk Abe
</pre>
151 3 Dirk Abe
152
after all restart apache:
153
<pre>
154
sudo service apache2 restart
155 1 Dirk Abe
</pre>
156
157
Open your browser and visit http://$IP/redmine
158
Finish.
159