F29Installation » History » Version 30

Gerd Pokorra, 2019-01-03 18:54

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 1 Gerd Pokorra
This guide is not complete. It will be completed 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 29 Gerd Pokorra
The Fedora distribution has not 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 12 Gerd Pokorra
h2. Obtaining Redmine (Step 1)
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 22 Gerd Pokorra
h2. Setup a local database server (Step 2)
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 11 Gerd Pokorra
h2. Firewall
193 11 Gerd Pokorra
194 11 Gerd Pokorra
Open the firewall for https:
195 11 Gerd Pokorra
196 11 Gerd Pokorra
<pre>> firewall-cmd --add-service=https
197 11 Gerd Pokorra
> firewall-cmd --permanent --add-service=https
198 11 Gerd Pokorra
</pre>
199 11 Gerd Pokorra
200 1 Gerd Pokorra
h2. Web Server
201 1 Gerd Pokorra
202 5 Gerd Pokorra
h3. Nginx/Passenger
203 2 Gerd Pokorra
204 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@:
205 2 Gerd Pokorra
206 2 Gerd Pokorra
* passenger-6.0.0
207 2 Gerd Pokorra
* nginx-1.14.2
208 2 Gerd Pokorra
209 4 Gerd Pokorra
h4. Downloading the sources:
210 2 Gerd Pokorra
211 2 Gerd Pokorra
<pre>Passenger
212 2 Gerd Pokorra
213 2 Gerd Pokorra
> cd /opt
214 2 Gerd Pokorra
> wget https://s3.amazonaws.com/phusion-passenger/releases/passenger-6.0.0.tar.gz
215 2 Gerd Pokorra
> tar xf passenger-6.0.0.tar.gz
216 2 Gerd Pokorra
217 2 Gerd Pokorra
Nginx
218 2 Gerd Pokorra
219 2 Gerd Pokorra
> wget http://nginx.org/download/nginx-1.14.2.tar.gz
220 2 Gerd Pokorra
> mkdir /opt/src
221 2 Gerd Pokorra
> cd /opt/src
222 2 Gerd Pokorra
> tar xf nginx-1.14.2.tar.gz
223 2 Gerd Pokorra
</pre>
224 1 Gerd Pokorra
225 3 Gerd Pokorra
h4. Installing additional packages
226 3 Gerd Pokorra
227 3 Gerd Pokorra
For the build of @passenger@ and @nginx@ the following additional packages are needed to be installed:
228 3 Gerd Pokorra
229 3 Gerd Pokorra
<pre>> dnf install install gcc-c++ libcurl-devel openssl-devel zlib-devel
230 3 Gerd Pokorra
</pre>
231 1 Gerd Pokorra
232 5 Gerd Pokorra
h4. Execute the ruby script for building and installing
233 1 Gerd Pokorra
234 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@.
235 5 Gerd Pokorra
236 5 Gerd Pokorra
<pre>> /opt/passenger-6.0.0/bin
237 5 Gerd Pokorra
> ./passenger-install-nginx-module --prefix=/opt/nginx --nginx-source-dir=/opt/src/nginx-1.14.2 --languages ruby
238 5 Gerd Pokorra
</pre>
239 3 Gerd Pokorra
240 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:
241 6 Gerd Pokorra
242 6 Gerd Pokorra
<pre>  http {
243 6 Gerd Pokorra
      ...
244 6 Gerd Pokorra
      passenger_root /opt/passenger-6.0.0;
245 6 Gerd Pokorra
      passenger_ruby /usr/bin/ruby;
246 6 Gerd Pokorra
      ...
247 6 Gerd Pokorra
  }
248 6 Gerd Pokorra
</pre>
249 6 Gerd Pokorra
250 8 Gerd Pokorra
h4. Add a systemd service file
251 8 Gerd Pokorra
252 8 Gerd Pokorra
To start the @nginx@ process during the boot add the file @/usr/lib/systemd/system/nginx.service@ with the following content:
253 8 Gerd Pokorra
254 8 Gerd Pokorra
<pre>[Unit]
255 8 Gerd Pokorra
Description=The nginx HTTP and reverse proxy server
256 8 Gerd Pokorra
After=network.target remote-fs.target nss-lookup.target
257 8 Gerd Pokorra
258 8 Gerd Pokorra
[Service]
259 8 Gerd Pokorra
Type=forking
260 8 Gerd Pokorra
#PIDFile=/run/nginx.pid
261 8 Gerd Pokorra
PIDFile=/opt/nginx/logs/nginx.pid
262 8 Gerd Pokorra
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
263 8 Gerd Pokorra
# SELinux context. This might happen when running `nginx -t` from the cmdline.
264 8 Gerd Pokorra
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
265 8 Gerd Pokorra
ExecStartPre=/usr/bin/rm -f /opt/nginx/logs/nginx.pid
266 8 Gerd Pokorra
#ExecStartPre=/usr/sbin/nginx -t
267 8 Gerd Pokorra
#ExecStart=/usr/sbin/nginx
268 8 Gerd Pokorra
ExecStartPre=/opt/nginx/sbin/nginx -t
269 8 Gerd Pokorra
ExecStart=/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf
270 8 Gerd Pokorra
ExecReload=/bin/kill -s HUP $MAINPID
271 8 Gerd Pokorra
KillSignal=SIGQUIT
272 8 Gerd Pokorra
TimeoutStopSec=5
273 8 Gerd Pokorra
KillMode=mixed
274 8 Gerd Pokorra
PrivateTmp=true
275 8 Gerd Pokorra
276 8 Gerd Pokorra
[Install]
277 8 Gerd Pokorra
WantedBy=multi-user.target
278 8 Gerd Pokorra
</pre>
279 8 Gerd Pokorra
280 8 Gerd Pokorra
The paths are modified to start the executable @/opt/nginx/sbin/nginx@.
281 8 Gerd Pokorra
282 8 Gerd Pokorra
<pre>> systemctl start nginx
283 8 Gerd Pokorra
> systemctl enable nginx
284 8 Gerd Pokorra
</pre>
285 8 Gerd Pokorra
286 9 Gerd Pokorra
h4. Nginx Configuration
287 9 Gerd Pokorra
288 9 Gerd Pokorra
For http add the two lines and comment out the four lines:
289 9 Gerd Pokorra
290 9 Gerd Pokorra
<pre>    server {
291 9 Gerd Pokorra
        listen       80;
292 9 Gerd Pokorra
...
293 9 Gerd Pokorra
        root         /var/www/redmine-4.0.0/public;
294 9 Gerd Pokorra
        passenger_enabled on;
295 9 Gerd Pokorra
        #location / {
296 9 Gerd Pokorra
        #    root   html;
297 9 Gerd Pokorra
        #    index  index.html index.htm;
298 9 Gerd Pokorra
        #}
299 9 Gerd Pokorra
...
300 9 Gerd Pokorra
       }
301 9 Gerd Pokorra
</pre>
302 9 Gerd Pokorra
303 10 Gerd Pokorra
For https add you can use lines like this:
304 10 Gerd Pokorra
305 10 Gerd Pokorra
<pre>    # HTTPS server
306 10 Gerd Pokorra
    #
307 10 Gerd Pokorra
    server {
308 10 Gerd Pokorra
        listen       443 ssl;
309 10 Gerd Pokorra
        server_name  my_web_serv.domain;
310 10 Gerd Pokorra
311 10 Gerd Pokorra
        ssl_certificate      /etc/ssl/certs/my_web_serv.pem;
312 10 Gerd Pokorra
        ssl_certificate_key  /etc/ssl/private/privkey.pem;
313 10 Gerd Pokorra
314 10 Gerd Pokorra
        root         /var/www/redmine-4.0.0/public;
315 10 Gerd Pokorra
        passenger_enabled on;
316 10 Gerd Pokorra
    }
317 10 Gerd Pokorra
</pre>
318 10 Gerd Pokorra
319 1 Gerd Pokorra
h3. Apache