Project

General

Profile

HowTo Install Redmine on Debian 9 » History » Version 8

Gael Porte, 2019-12-30 19:23
Add "cd" command to go to config directory before the bundle install

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 8 Gael Porte
cd /opt/redmine/redmine-3.4.11/config/
90 5 Fabián Rodríguez
bundle install
91
bundle exec rake generate_secret_token
92
RAILS_ENV=production bundle exec rake db:migrate
93
RAILS_ENV=production bundle exec rake redmine:load_default_data
94
</pre>
95 1 Bruce Schaller
96
8.Do a quick test to verify that redmine is working using webrick.
97
98 5 Fabián Rodríguez
<pre>
99
bundle exec ruby /usr/bin/rails server -b your_ip webrick -e production
100
</pre>
101 1 Bruce Schaller
102 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.
103 1 Bruce Schaller
104
9. Next, let’s set up Apache.
105
106 5 Fabián Rodríguez
<pre>
107
cd /opt/
108
sudo chown -R www-data:www-data /opt/redmine
109 7 Olivier Locard
cd /opt/redmine/redmine-3.4.11
110 5 Fabián Rodríguez
sudo chmod -R 755 files log tmp public/plugin_assets
111
sudo chown www-data:www-data Gemfile.lock
112
</pre>
113 1 Bruce Schaller
114 5 Fabián Rodríguez
9.1 Create a symbolic link which points from the Apache working directory to the Redmine public folder
115 1 Bruce Schaller
116 5 Fabián Rodríguez
<pre>
117 7 Olivier Locard
sudo ln -s /opt/redmine/redmine-3.4.11/public/ /var/www/html/redmine
118 5 Fabián Rodríguez
</pre>
119 1 Bruce Schaller
120 5 Fabián Rodríguez
9.2 Create a new vhost configuration
121 1 Bruce Schaller
122 5 Fabián Rodríguez
<pre>
123
sudo nano /etc/apache2/sites-available/master.conf
124
</pre>
125 1 Bruce Schaller
126 5 Fabián Rodríguez
and paste in:
127 1 Bruce Schaller
128 5 Fabián Rodríguez
<pre>
129
<VirtualHost *:80>
130 1 Bruce Schaller
131 5 Fabián Rodríguez
ServerAdmin admin@example.com
132
Servername hostname
133
DocumentRoot /var/www/html/
134 1 Bruce Schaller
135 5 Fabián Rodríguez
<Location /redmine>
136
RailsEnv production
137
RackBaseURI /redmine
138
Options -MultiViews
139
</Location>
140 1 Bruce Schaller
141 5 Fabián Rodríguez
</VirtualHost>
142 1 Bruce Schaller
143 5 Fabián Rodríguez
</pre>
144 3 Bruce Schaller
145 5 Fabián Rodríguez
Then, run:
146 3 Bruce Schaller
147 5 Fabián Rodríguez
<pre>
148
sudo a2dissite 000-default.conf
149
sudo a2ensite master.conf
150
</pre>
151 1 Bruce Schaller
152 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.
153 1 Bruce Schaller
154 5 Fabián Rodríguez
<pre>
155
PassengerUser www-data
156
</pre>
157 1 Bruce Schaller
158 5 Fabián Rodríguez
Restart the Apache web server:
159 1 Bruce Schaller
160 5 Fabián Rodríguez
<pre>
161
sudo service apache2 restart
162
</pre>
163 1 Bruce Schaller
164 5 Fabián Rodríguez
10. Open your browser and navigate to: @http://your-ip-address/redmine@.
165 1 Bruce Schaller
166
And hopefully, you're up and running.
167
168
Sources:
169
* [[HowTo Install Redmine on Debian 8 with Apache2-Passenger|Redmine with Apache and MySQL on Debian 8 jessie]]
170 6 Zer00 CooL
171
Additional resources
172
173
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.
174
175
https://www.visionduweb.eu/wiki/index.php?title=Installer_Redmine_sur_Debian