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 2 Bruce Schaller
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 5 Fabián Rodríguez
sudo apt install gcc build-essential zlib1g zlib1g-dev zlibc ruby-zip libssl-dev libyaml-dev \
19 5 Fabián Rodríguez
libcurl4-openssl-dev ruby gem libapache2-mod-passenger apache2 apache2-dev libapr1-dev \
20 5 Fabián Rodríguez
libxslt1-dev checkinstall libxml2-dev ruby-dev vim libmagickwand-dev imagemagick sudo rails
21 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
apt install postgresql
27 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
apt install postgresql-server-dev-9.6
33 5 Fabián Rodríguez
</pre>
34 5 Fabián Rodríguez
 
35 5 Fabián Rodríguez
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 5 Fabián Rodríguez
cd /opt
41 5 Fabián Rodríguez
mkdir redmine
42 5 Fabián Rodríguez
cd redmine
43 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
<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 5 Fabián Rodríguez
sudo -u postgres psql postgres
60 5 Fabián Rodríguez
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'your_password' NOINHERIT VALID UNTIL 'infinity';
61 5 Fabián Rodríguez
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
62 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
"local all postgres trust "
70 5 Fabián Rodríguez
sudo service postgresql reload 
71 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
production:
77 5 Fabián Rodríguez
  adapter: postgresql
78 5 Fabián Rodríguez
  database: redmine
79 5 Fabián Rodríguez
  host: localhost
80 5 Fabián Rodríguez
  username: redmine
81 5 Fabián Rodríguez
  password: your_password
82 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
bundle exec rake generate_secret_token
92 5 Fabián Rodríguez
RAILS_ENV=production bundle exec rake db:migrate
93 5 Fabián Rodríguez
RAILS_ENV=production bundle exec rake redmine:load_default_data
94 5 Fabián Rodríguez
</pre>
95 1 Bruce Schaller
96 1 Bruce Schaller
8.Do a quick test to verify that redmine is working using webrick.
97 1 Bruce Schaller
98 5 Fabián Rodríguez
<pre>
99 5 Fabián Rodríguez
bundle exec ruby /usr/bin/rails server -b your_ip webrick -e production
100 5 Fabián Rodríguez
</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 1 Bruce Schaller
9. Next, let’s set up Apache.
105 1 Bruce Schaller
106 5 Fabián Rodríguez
<pre>
107 5 Fabián Rodríguez
cd /opt/
108 5 Fabián Rodríguez
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 5 Fabián Rodríguez
sudo chown www-data:www-data Gemfile.lock
112 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
sudo nano /etc/apache2/sites-available/master.conf
124 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
<VirtualHost *:80>
130 1 Bruce Schaller
131 5 Fabián Rodríguez
ServerAdmin admin@example.com
132 5 Fabián Rodríguez
Servername hostname
133 5 Fabián Rodríguez
DocumentRoot /var/www/html/
134 1 Bruce Schaller
135 5 Fabián Rodríguez
<Location /redmine>
136 5 Fabián Rodríguez
RailsEnv production
137 5 Fabián Rodríguez
RackBaseURI /redmine
138 5 Fabián Rodríguez
Options -MultiViews
139 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
sudo a2dissite 000-default.conf
149 5 Fabián Rodríguez
sudo a2ensite master.conf
150 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
PassengerUser www-data
156 5 Fabián Rodríguez
</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 5 Fabián Rodríguez
sudo service apache2 restart
162 5 Fabián Rodríguez
</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 1 Bruce Schaller
And hopefully, you're up and running.
167 1 Bruce Schaller
168 1 Bruce Schaller
Sources:
169 1 Bruce Schaller
* [[HowTo Install Redmine on Debian 8 with Apache2-Passenger|Redmine with Apache and MySQL on Debian 8 jessie]]
170 6 Bernard Bass
171 6 Bernard Bass
Additional resources
172 6 Bernard Bass
173 6 Bernard Bass
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 6 Bernard Bass
175 6 Bernard Bass
https://www.visionduweb.eu/wiki/index.php?title=Installer_Redmine_sur_Debian