Project

General

Profile

HowTo Install Redmine on Debian 9 » History » Version 7

Olivier Locard, 2019-07-23 14:23

1 2 Bruce Schaller
h1. How to Install Redmine on Debian 9 (Stretch)
2
3 5 Fabián Rodríguez
h2. Installing from Debian packages
4 2 Bruce Schaller
5 7 Olivier Locard
Official Redmine packages are available for Debian. As of July 2018, stable version 3.4.11 is supported in Debian 9.
6 1 Bruce Schaller
7 5 Fabián Rodríguez
If you will be using Redmine in a production environment requiring long term support and stability using official packages is recommended. You will be receiving automatic feature and security updates.
8 1 Bruce Schaller
9 5 Fabián Rodríguez
See "the Redmine documentation on the Debian Wiki":https://wiki.debian.org/Redmine for detailed instructions.
10 1 Bruce Schaller
11 5 Fabián Rodríguez
h2. Installing from sources
12 1 Bruce Schaller
13 5 Fabián Rodríguez
If you want the very latest Redmine version and are comfortable doing manual upgrades and system administration, the following steps will guide you through installing Redmine from sources. 
14 1 Bruce Schaller
15 5 Fabián Rodríguez
1. Install the pre-requisites for Redmine and all its packages.
16 1 Bruce Schaller
17 5 Fabián Rodríguez
<pre>
18
sudo apt install gcc build-essential zlib1g zlib1g-dev zlibc ruby-zip libssl-dev libyaml-dev \
19
libcurl4-openssl-dev ruby gem libapache2-mod-passenger apache2 apache2-dev libapr1-dev \
20
libxslt1-dev checkinstall libxml2-dev ruby-dev vim libmagickwand-dev imagemagick sudo rails
21
</pre>
22 1 Bruce Schaller
23 5 Fabián Rodríguez
2.  Install your database of choice. 
24 1 Bruce Schaller
25 5 Fabián Rodríguez
<pre>
26
apt install postgresql
27
</pre>
28 1 Bruce Schaller
29 5 Fabián Rodríguez
3. If installing Postgres, install dev.
30 1 Bruce Schaller
31 5 Fabián Rodríguez
<pre>
32
apt install postgresql-server-dev-9.6
33
</pre>
34
 
35
4. Choose a directory where to install Redmine.  In this example /opt used.  You can use another location, but you will need to update the following steps as necessary based on your choice.
36 1 Bruce Schaller
37 5 Fabián Rodríguez
Install Redmine in /opt
38 1 Bruce Schaller
39 5 Fabián Rodríguez
<pre>
40
cd /opt
41
mkdir redmine
42
cd redmine
43
</pre>
44 1 Bruce Schaller
45 5 Fabián Rodríguez
Get Redmine  - use the "download":http://www.redmine.org/projects/redmine/wiki/Download page and review the functionality that you need to determine the right version for you. 
46 1 Bruce Schaller
47 5 Fabián Rodríguez
<pre>
48 7 Olivier Locard
wget http://www.redmine.org/releases/redmine-3.4.11.tar.gz
49 5 Fabián Rodríguez
</pre>
50 1 Bruce Schaller
51 5 Fabián Rodríguez
Unpack
52
<pre>
53 7 Olivier Locard
tar xzf ./redmine-3.4.11.tar.gz
54 5 Fabián Rodríguez
</pre>
55 1 Bruce Schaller
56 5 Fabián Rodríguez
5. Login as the default postgres user and create a new role and database. Use your own password.
57 1 Bruce Schaller
58 5 Fabián Rodríguez
<pre>
59
sudo -u postgres psql postgres
60
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'your_password' NOINHERIT VALID UNTIL 'infinity';
61
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
62
</pre>
63 1 Bruce Schaller
64 5 Fabián Rodríguez
then press CTRL-D to escape the shell.
65 1 Bruce Schaller
66 5 Fabián Rodríguez
edit @/etc/postgresql/9.6/main/pg_hba.conf@ and set Postgres to trust : 
67 1 Bruce Schaller
68 5 Fabián Rodríguez
<pre>
69
"local all postgres trust "
70
sudo service postgresql reload 
71
</pre>
72 1 Bruce Schaller
73 7 Olivier Locard
6. Create the @/opt/redmine/redmine-3.4.11/config/database.yml@ file with the following contents…
74 1 Bruce Schaller
75 5 Fabián Rodríguez
<pre>
76
production:
77
  adapter: postgresql
78
  database: redmine
79
  host: localhost
80
  username: redmine
81
  password: your_password
82
</pre>
83 1 Bruce Schaller
84 5 Fabián Rodríguez
Note that the spacing is important in this file. Under the “Production” line, each other line must be indented by two spaces, not tabs.  Replace your_password with the password specified above. Remember to save.  Keep in mind Postgresql passwords can't start with @ character (or other non alpha numerics).
85 1 Bruce Schaller
86 5 Fabián Rodríguez
7. Next, set up the database schema and load the initial database.
87 1 Bruce Schaller
88 5 Fabián Rodríguez
<pre>
89
bundle install
90
bundle exec rake generate_secret_token
91
RAILS_ENV=production bundle exec rake db:migrate
92
RAILS_ENV=production bundle exec rake redmine:load_default_data
93
</pre>
94 1 Bruce Schaller
95
8.Do a quick test to verify that redmine is working using webrick.
96
97 5 Fabián Rodríguez
<pre>
98
bundle exec ruby /usr/bin/rails server -b your_ip webrick -e production
99
</pre>
100 1 Bruce Schaller
101 5 Fabián Rodríguez
Now try to connect via browser to @http://your_ip:3000@. Webrick is not for production systems.  It is a good way to check things before getting started with Apache, though.
102 1 Bruce Schaller
103
9. Next, let’s set up Apache.
104
105 5 Fabián Rodríguez
<pre>
106
cd /opt/
107
sudo chown -R www-data:www-data /opt/redmine
108 7 Olivier Locard
cd /opt/redmine/redmine-3.4.11
109 5 Fabián Rodríguez
sudo chmod -R 755 files log tmp public/plugin_assets
110
sudo chown www-data:www-data Gemfile.lock
111
</pre>
112 1 Bruce Schaller
113 5 Fabián Rodríguez
9.1 Create a symbolic link which points from the Apache working directory to the Redmine public folder
114 1 Bruce Schaller
115 5 Fabián Rodríguez
<pre>
116 7 Olivier Locard
sudo ln -s /opt/redmine/redmine-3.4.11/public/ /var/www/html/redmine
117 5 Fabián Rodríguez
</pre>
118 1 Bruce Schaller
119 5 Fabián Rodríguez
9.2 Create a new vhost configuration
120 1 Bruce Schaller
121 5 Fabián Rodríguez
<pre>
122
sudo nano /etc/apache2/sites-available/master.conf
123
</pre>
124 1 Bruce Schaller
125 5 Fabián Rodríguez
and paste in:
126 1 Bruce Schaller
127 5 Fabián Rodríguez
<pre>
128
<VirtualHost *:80>
129 1 Bruce Schaller
130 5 Fabián Rodríguez
ServerAdmin admin@example.com
131
Servername hostname
132
DocumentRoot /var/www/html/
133 1 Bruce Schaller
134 5 Fabián Rodríguez
<Location /redmine>
135
RailsEnv production
136
RackBaseURI /redmine
137
Options -MultiViews
138
</Location>
139 1 Bruce Schaller
140 5 Fabián Rodríguez
</VirtualHost>
141 1 Bruce Schaller
142 5 Fabián Rodríguez
</pre>
143 3 Bruce Schaller
144 5 Fabián Rodríguez
Then, run:
145 3 Bruce Schaller
146 5 Fabián Rodríguez
<pre>
147
sudo a2dissite 000-default.conf
148
sudo a2ensite master.conf
149
</pre>
150 1 Bruce Schaller
151 5 Fabián Rodríguez
9.3 add this line to @/etc/apache2/mods-available/passenger.conf@ in the body of the document- not just the 1st line.
152 1 Bruce Schaller
153 5 Fabián Rodríguez
<pre>
154
PassengerUser www-data
155
</pre>
156 1 Bruce Schaller
157 5 Fabián Rodríguez
Restart the Apache web server:
158 1 Bruce Schaller
159 5 Fabián Rodríguez
<pre>
160
sudo service apache2 restart
161
</pre>
162 1 Bruce Schaller
163 5 Fabián Rodríguez
10. Open your browser and navigate to: @http://your-ip-address/redmine@.
164 1 Bruce Schaller
165
And hopefully, you're up and running.
166
167
Sources:
168
* [[HowTo Install Redmine on Debian 8 with Apache2-Passenger|Redmine with Apache and MySQL on Debian 8 jessie]]
169 6 Zer00 CooL
170
Additional resources
171
172
A tutorial updated in 2018 (01/10/2018), in French, which repeats step by step the installation of Redmine since the package proposed in the official repositories of Debian Stretch 9.
173
174
https://www.visionduweb.eu/wiki/index.php?title=Installer_Redmine_sur_Debian