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

Dirk Abe, 2015-04-03 14:58

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