F29Installation » History » Version 38

Gerd Pokorra, 2019-01-04 04:47

1 1 Gerd Pokorra
h1. HowTo Install Redmine 4.0.0 on Fedora 29
2 1 Gerd Pokorra
3 1 Gerd Pokorra
{{toc}}
4 1 Gerd Pokorra
5 36 Gerd Pokorra
The chapter for Apache is missing and the text of that chapter will be added in the next two weeks.
6 1 Gerd Pokorra
7 1 Gerd Pokorra
h2.  System Requirements
8 1 Gerd Pokorra
9 1 Gerd Pokorra
It is assumed that the Server Edition is installed on the system in this guide.
10 1 Gerd Pokorra
11 13 Gerd Pokorra
h3. Updating the System
12 13 Gerd Pokorra
  
13 13 Gerd Pokorra
It is recommended to install Redmine on an update system. To ensure that all installed packages are up-to-date issue the following command:
14 13 Gerd Pokorra
15 13 Gerd Pokorra
<pre>> dnf update
16 13 Gerd Pokorra
</pre>
17 13 Gerd Pokorra
18 14 Gerd Pokorra
h3. Installing Dependencies
19 14 Gerd Pokorra
20 14 Gerd Pokorra
A number of dependencies need to be installed:
21 14 Gerd Pokorra
22 14 Gerd Pokorra
<pre>> dnf install rubygem-bundler
23 14 Gerd Pokorra
> dnf install rubygem-rails
24 14 Gerd Pokorra
25 14 Gerd Pokorra
> dnf install ruby-devel rubygem-rmagick
26 14 Gerd Pokorra
> dnf install gcc redhat-rpm-config
27 14 Gerd Pokorra
28 14 Gerd Pokorra
> dnf groupinstall "C Development Tools and Libraries"
29 14 Gerd Pokorra
> dnf groupinstall "Development Tools"
30 14 Gerd Pokorra
</pre>
31 14 Gerd Pokorra
32 28 Gerd Pokorra
Database adapter for PostgreSQL:
33 16 Gerd Pokorra
  
34 1 Gerd Pokorra
<pre>> dnf install rubygem-pg
35 1 Gerd Pokorra
</pre>
36 17 Gerd Pokorra
37 28 Gerd Pokorra
Database adapter for MySQL:
38 27 Gerd Pokorra
<pre>> dnf install rubygem-mysql2
39 27 Gerd Pokorra
</pre>
40 27 Gerd Pokorra
41 29 Gerd Pokorra
Database adapter for MS SQL:
42 29 Gerd Pokorra
43 35 Gerd Pokorra
The Fedora distribution has no ruby software package for @tiny_tds@. The following dependency is needed for the build:
44 29 Gerd Pokorra
45 29 Gerd Pokorra
<pre>> dnf install freetds-devel
46 29 Gerd Pokorra
> # Now the build should work
47 29 Gerd Pokorra
> bundle install --without development test
48 29 Gerd Pokorra
</pre>
49 29 Gerd Pokorra
50 29 Gerd Pokorra
51 29 Gerd Pokorra
52 17 Gerd Pokorra
The list of dependencies may not complete. Problems of the installation or build of a compoment can be solved by installing the necessary dependency.
53 16 Gerd Pokorra
54 34 Gerd Pokorra
h2. Step 1 - Obtaining Redmine
55 12 Gerd Pokorra
56 12 Gerd Pokorra
Get the Redmine source code by downloading the packaged release.
57 12 Gerd Pokorra
58 12 Gerd Pokorra
<pre>> dnf install wget
59 12 Gerd Pokorra
60 12 Gerd Pokorra
> mkdir /var/www
61 12 Gerd Pokorra
> cd /var/www
62 12 Gerd Pokorra
63 12 Gerd Pokorra
> wget http://www.redmine.org/releases/redmine-4.0.0.tar.gz
64 12 Gerd Pokorra
> tar xf redmine-4.0.0.tar.gz
65 12 Gerd Pokorra
</pre>
66 12 Gerd Pokorra
67 12 Gerd Pokorra
At this guide is accepted that the location of the Redmine source code is:
68 12 Gerd Pokorra
69 12 Gerd Pokorra
<pre>/var/www/redmine-4.0.0
70 12 Gerd Pokorra
</pre>
71 12 Gerd Pokorra
72 12 Gerd Pokorra
For example the nginx configuration refer to the path @/var/www/redmine-4.0.0@.
73 16 Gerd Pokorra
74 34 Gerd Pokorra
h2. Setp 2 - Setup a local database
75 16 Gerd Pokorra
76 16 Gerd Pokorra
This section discribes the setup of a database server that will be configured to allow access from the localhost.
77 16 Gerd Pokorra
78 16 Gerd Pokorra
h3. PostgreSQL
79 16 Gerd Pokorra
80 18 Gerd Pokorra
The followings commands are for installing the packages, initializing the database, enable and start the postgresql server, switch the user to interact with @postgres@, create an empty database and accompanying user.
81 18 Gerd Pokorra
82 18 Gerd Pokorra
<pre>> dnf install postgresql-server postgresql-contrib
83 18 Gerd Pokorra
> postgresql-setup --initdb --unit postgresql
84 18 Gerd Pokorra
 * Initializing database in '/var/lib/pgsql/data'
85 18 Gerd Pokorra
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
86 18 Gerd Pokorra
>
87 18 Gerd Pokorra
> systemctl enable postgresql
88 18 Gerd Pokorra
> systemctl start postgresql
89 18 Gerd Pokorra
> su - postgres
90 18 Gerd Pokorra
> psql
91 18 Gerd Pokorra
psql (10.6)
92 18 Gerd Pokorra
Type "help" for help.
93 18 Gerd Pokorra
94 18 Gerd Pokorra
postgres=# CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_secret' NOINHERIT VALID UNTIL 'infinity';
95 18 Gerd Pokorra
CREATE ROLE
96 18 Gerd Pokorra
postgres=# CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
97 18 Gerd Pokorra
CREATE DATABASE
98 18 Gerd Pokorra
postgres=# \q
99 18 Gerd Pokorra
> exit
100 18 Gerd Pokorra
</pre>
101 18 Gerd Pokorra
102 19 Gerd Pokorra
Edit the file @/var/lib/pgsql/data/pg_hba.conf@ to specify that the client has to supply password processed with MD5 algorithm:
103 19 Gerd Pokorra
104 19 Gerd Pokorra
<pre>#host    all             all             127.0.0.1/32            ident
105 19 Gerd Pokorra
host    all             all             127.0.0.1/32            md5
106 19 Gerd Pokorra
# IPv6 local connections:
107 19 Gerd Pokorra
#host    all             all             ::1/128                 ident
108 19 Gerd Pokorra
host    all             all             ::1/128                 md5
109 19 Gerd Pokorra
</pre>
110 19 Gerd Pokorra
111 19 Gerd Pokorra
You can check the access with the following command:
112 19 Gerd Pokorra
113 19 Gerd Pokorra
<pre>> su - postgres
114 20 Gerd Pokorra
> psql -h localhost -U redmine redmine
115 1 Gerd Pokorra
</pre>
116 20 Gerd Pokorra
117 20 Gerd Pokorra
The appropriate Redmine database configuration file for local access is:
118 20 Gerd Pokorra
119 21 Gerd Pokorra
<pre>> cat /var/www/redmine-4.0.0/config/database.yml
120 20 Gerd Pokorra
# PostgreSQL configuration
121 20 Gerd Pokorra
production:
122 20 Gerd Pokorra
  adapter: postgresql
123 20 Gerd Pokorra
  database: redmine
124 20 Gerd Pokorra
  host: localhost
125 20 Gerd Pokorra
  username: redmine
126 20 Gerd Pokorra
  password: "my_secret"
127 20 Gerd Pokorra
  encoding: utf8
128 1 Gerd Pokorra
  schema_search_path: public
129 21 Gerd Pokorra
</pre>
130 20 Gerd Pokorra
131 20 Gerd Pokorra
If you want to use IPv4 you have to specify @localhost4@ as hostname.
132 19 Gerd Pokorra
133 1 Gerd Pokorra
h3. MySQL
134 22 Gerd Pokorra
135 22 Gerd Pokorra
Install the MySQL repositry
136 22 Gerd Pokorra
137 22 Gerd Pokorra
<pre>> dnf -y install https://dev.mysql.com/get/mysql80-community-release-fc29-1.noarch.rpm
138 22 Gerd Pokorra
</pre>
139 22 Gerd Pokorra
140 22 Gerd Pokorra
If you prefer to stick to MySQL 5.7
141 22 Gerd Pokorra
142 22 Gerd Pokorra
<pre>> dnf config-manager --set-enabled mysql57-community
143 22 Gerd Pokorra
> dnf config-manager --set-disabled mysql80-community
144 22 Gerd Pokorra
</pre>
145 22 Gerd Pokorra
146 23 Gerd Pokorra
Install the MySQL server package, start the MySQL server and autostart the daemon on boot
147 23 Gerd Pokorra
148 22 Gerd Pokorra
<pre>> dnf -y install mysql-community-server
149 22 Gerd Pokorra
> systemctl start mysqld.service
150 22 Gerd Pokorra
> systemctl enable mysqld.service
151 22 Gerd Pokorra
</pre>
152 12 Gerd Pokorra
153 24 Gerd Pokorra
Get your generated random root password you will need it at the next step.
154 24 Gerd Pokorra
155 24 Gerd Pokorra
<pre>> grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log |tail -1
156 24 Gerd Pokorra
</pre>
157 24 Gerd Pokorra
158 24 Gerd Pokorra
Start the secure installation assistant to
159 24 Gerd Pokorra
160 25 Gerd Pokorra
* change root password
161 25 Gerd Pokorra
* remove anonymous users
162 25 Gerd Pokorra
* disallow root login remotely
163 25 Gerd Pokorra
* remove test database and access to it
164 25 Gerd Pokorra
* reload privilege tables
165 24 Gerd Pokorra
166 24 Gerd Pokorra
<pre>> mysql_secure_installation
167 24 Gerd Pokorra
</pre>
168 24 Gerd Pokorra
169 26 Gerd Pokorra
Creation of user and database for Redmine
170 26 Gerd Pokorra
171 26 Gerd Pokorra
<pre>> mysql -h localhost -u root -p
172 26 Gerd Pokorra
Enter password:
173 26 Gerd Pokorra
...
174 26 Gerd Pokorra
mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;
175 26 Gerd Pokorra
mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_secret';
176 26 Gerd Pokorra
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
177 26 Gerd Pokorra
mysql> \q
178 26 Gerd Pokorra
</pre>
179 26 Gerd Pokorra
180 30 Gerd Pokorra
The appropriate Redmine database configuration file for local accessing the MySQL database is:
181 30 Gerd Pokorra
182 30 Gerd Pokorra
<pre>> cat /var/www/redmine-4.0.0/config/database.yml
183 30 Gerd Pokorra
# MySQL configuration
184 30 Gerd Pokorra
production:
185 30 Gerd Pokorra
  adapter: mysql2
186 30 Gerd Pokorra
  database: redmine
187 30 Gerd Pokorra
  host: localhost
188 30 Gerd Pokorra
  username: redmine
189 30 Gerd Pokorra
  password: "my_secret"
190 30 Gerd Pokorra
</pre>
191 30 Gerd Pokorra
192 31 Gerd Pokorra
h2. Step 3 to Step 9
193 31 Gerd Pokorra
194 33 Gerd Pokorra
For Step 3 to Step 9 follow the [[RedmineInstall#Step-3-Database-connection-configuration|generic installation instructions]]. Following is the overview of the commands:
195 31 Gerd Pokorra
196 31 Gerd Pokorra
<pre>> bundle install --without development test
197 31 Gerd Pokorra
> bundle exec rake generate_secret_token
198 31 Gerd Pokorra
> RAILS_ENV=production bundle exec rake db:migrate
199 31 Gerd Pokorra
> RAILS_ENV=production bundle exec rake redmine:load_default_data
200 31 Gerd Pokorra
201 31 Gerd Pokorra
> mkdir -p tmp tmp/pdf public/plugin_assets
202 31 Gerd Pokorra
> chown -R redmine:redmine files log tmp public/plugin_assets
203 31 Gerd Pokorra
> chmod -R 755 files log tmp public/plugin_assets
204 31 Gerd Pokorra
205 31 Gerd Pokorra
> find files log tmp public/plugin_assets -type f -exec chmod -x {} +
206 31 Gerd Pokorra
207 31 Gerd Pokorra
> bundle exec rails server webrick -e production
208 31 Gerd Pokorra
</pre>
209 31 Gerd Pokorra
210 37 Gerd Pokorra
* Tip:
211 37 Gerd Pokorra
212 37 Gerd Pokorra
> Over one ssh-tunnel you can easily connect to Port 3000 of the WEBrick web server.
213 37 Gerd Pokorra
> 
214 38 Gerd Pokorra
> <pre>> ssh root@<redmine-host.domain> -L 3000:localhost:3000</pre>
215 37 Gerd Pokorra
> 
216 37 Gerd Pokorra
> Open the local webbrower to show the URL 'http://localhost:3000':
217 37 Gerd Pokorra
> 
218 37 Gerd Pokorra
> <pre>> firefox localhost:3000
219 37 Gerd Pokorra
> </pre>
220 37 Gerd Pokorra
221 11 Gerd Pokorra
h2. Firewall
222 11 Gerd Pokorra
223 11 Gerd Pokorra
Open the firewall for https:
224 11 Gerd Pokorra
225 11 Gerd Pokorra
<pre>> firewall-cmd --add-service=https
226 11 Gerd Pokorra
> firewall-cmd --permanent --add-service=https
227 11 Gerd Pokorra
</pre>
228 11 Gerd Pokorra
229 1 Gerd Pokorra
h2. Web Server
230 1 Gerd Pokorra
231 5 Gerd Pokorra
h3. Nginx/Passenger
232 2 Gerd Pokorra
233 2 Gerd Pokorra
The Fedora @nginx@ package do not include Passenger, so you have to build @nginx@ with the passenger module. The guide assume that the sources are extracted under the directory @/opt@ . The @nginx@ software will be installed at @/opt/ngnix@. At the time of writting that guide this was the current stable releases of @passenger@ and @nginx@:
234 2 Gerd Pokorra
235 2 Gerd Pokorra
* passenger-6.0.0
236 2 Gerd Pokorra
* nginx-1.14.2
237 2 Gerd Pokorra
238 4 Gerd Pokorra
h4. Downloading the sources:
239 2 Gerd Pokorra
240 2 Gerd Pokorra
<pre>Passenger
241 2 Gerd Pokorra
242 2 Gerd Pokorra
> cd /opt
243 2 Gerd Pokorra
> wget https://s3.amazonaws.com/phusion-passenger/releases/passenger-6.0.0.tar.gz
244 2 Gerd Pokorra
> tar xf passenger-6.0.0.tar.gz
245 2 Gerd Pokorra
246 2 Gerd Pokorra
Nginx
247 2 Gerd Pokorra
248 2 Gerd Pokorra
> wget http://nginx.org/download/nginx-1.14.2.tar.gz
249 2 Gerd Pokorra
> mkdir /opt/src
250 2 Gerd Pokorra
> cd /opt/src
251 2 Gerd Pokorra
> tar xf nginx-1.14.2.tar.gz
252 2 Gerd Pokorra
</pre>
253 1 Gerd Pokorra
254 3 Gerd Pokorra
h4. Installing additional packages
255 3 Gerd Pokorra
256 3 Gerd Pokorra
For the build of @passenger@ and @nginx@ the following additional packages are needed to be installed:
257 3 Gerd Pokorra
258 3 Gerd Pokorra
<pre>> dnf install install gcc-c++ libcurl-devel openssl-devel zlib-devel
259 3 Gerd Pokorra
</pre>
260 1 Gerd Pokorra
261 5 Gerd Pokorra
h4. Execute the ruby script for building and installing
262 1 Gerd Pokorra
263 5 Gerd Pokorra
The simplest way to build and install the @nginx@ web server with the @passenger@ module is to run the script @passenger-install-nginx-module@.
264 5 Gerd Pokorra
265 5 Gerd Pokorra
<pre>> /opt/passenger-6.0.0/bin
266 5 Gerd Pokorra
> ./passenger-install-nginx-module --prefix=/opt/nginx --nginx-source-dir=/opt/src/nginx-1.14.2 --languages ruby
267 5 Gerd Pokorra
</pre>
268 3 Gerd Pokorra
269 7 Gerd Pokorra
With the same @passenger@ locality the installer modify the @nginx@ configuration file @/opt/nginx/conf/nginx.conf@ and output the same text:
270 6 Gerd Pokorra
271 6 Gerd Pokorra
<pre>  http {
272 6 Gerd Pokorra
      ...
273 6 Gerd Pokorra
      passenger_root /opt/passenger-6.0.0;
274 6 Gerd Pokorra
      passenger_ruby /usr/bin/ruby;
275 6 Gerd Pokorra
      ...
276 6 Gerd Pokorra
  }
277 6 Gerd Pokorra
</pre>
278 6 Gerd Pokorra
279 8 Gerd Pokorra
h4. Add a systemd service file
280 8 Gerd Pokorra
281 8 Gerd Pokorra
To start the @nginx@ process during the boot add the file @/usr/lib/systemd/system/nginx.service@ with the following content:
282 8 Gerd Pokorra
283 8 Gerd Pokorra
<pre>[Unit]
284 8 Gerd Pokorra
Description=The nginx HTTP and reverse proxy server
285 8 Gerd Pokorra
After=network.target remote-fs.target nss-lookup.target
286 8 Gerd Pokorra
287 8 Gerd Pokorra
[Service]
288 8 Gerd Pokorra
Type=forking
289 8 Gerd Pokorra
#PIDFile=/run/nginx.pid
290 8 Gerd Pokorra
PIDFile=/opt/nginx/logs/nginx.pid
291 8 Gerd Pokorra
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
292 8 Gerd Pokorra
# SELinux context. This might happen when running `nginx -t` from the cmdline.
293 8 Gerd Pokorra
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
294 8 Gerd Pokorra
ExecStartPre=/usr/bin/rm -f /opt/nginx/logs/nginx.pid
295 8 Gerd Pokorra
#ExecStartPre=/usr/sbin/nginx -t
296 8 Gerd Pokorra
#ExecStart=/usr/sbin/nginx
297 8 Gerd Pokorra
ExecStartPre=/opt/nginx/sbin/nginx -t
298 8 Gerd Pokorra
ExecStart=/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf
299 8 Gerd Pokorra
ExecReload=/bin/kill -s HUP $MAINPID
300 8 Gerd Pokorra
KillSignal=SIGQUIT
301 8 Gerd Pokorra
TimeoutStopSec=5
302 8 Gerd Pokorra
KillMode=mixed
303 8 Gerd Pokorra
PrivateTmp=true
304 8 Gerd Pokorra
305 8 Gerd Pokorra
[Install]
306 8 Gerd Pokorra
WantedBy=multi-user.target
307 8 Gerd Pokorra
</pre>
308 8 Gerd Pokorra
309 8 Gerd Pokorra
The paths are modified to start the executable @/opt/nginx/sbin/nginx@.
310 8 Gerd Pokorra
311 8 Gerd Pokorra
<pre>> systemctl start nginx
312 8 Gerd Pokorra
> systemctl enable nginx
313 8 Gerd Pokorra
</pre>
314 8 Gerd Pokorra
315 9 Gerd Pokorra
h4. Nginx Configuration
316 9 Gerd Pokorra
317 9 Gerd Pokorra
For http add the two lines and comment out the four lines:
318 9 Gerd Pokorra
319 9 Gerd Pokorra
<pre>    server {
320 9 Gerd Pokorra
        listen       80;
321 9 Gerd Pokorra
...
322 9 Gerd Pokorra
        root         /var/www/redmine-4.0.0/public;
323 9 Gerd Pokorra
        passenger_enabled on;
324 9 Gerd Pokorra
        #location / {
325 9 Gerd Pokorra
        #    root   html;
326 9 Gerd Pokorra
        #    index  index.html index.htm;
327 9 Gerd Pokorra
        #}
328 9 Gerd Pokorra
...
329 9 Gerd Pokorra
       }
330 9 Gerd Pokorra
</pre>
331 9 Gerd Pokorra
332 10 Gerd Pokorra
For https add you can use lines like this:
333 10 Gerd Pokorra
334 10 Gerd Pokorra
<pre>    # HTTPS server
335 10 Gerd Pokorra
    #
336 10 Gerd Pokorra
    server {
337 10 Gerd Pokorra
        listen       443 ssl;
338 10 Gerd Pokorra
        server_name  my_web_serv.domain;
339 10 Gerd Pokorra
340 10 Gerd Pokorra
        ssl_certificate      /etc/ssl/certs/my_web_serv.pem;
341 10 Gerd Pokorra
        ssl_certificate_key  /etc/ssl/private/privkey.pem;
342 10 Gerd Pokorra
343 10 Gerd Pokorra
        root         /var/www/redmine-4.0.0/public;
344 10 Gerd Pokorra
        passenger_enabled on;
345 10 Gerd Pokorra
    }
346 10 Gerd Pokorra
</pre>
347 10 Gerd Pokorra
348 1 Gerd Pokorra
h3. Apache