Install Redmine on Fedora » History » Version 2

Gerd Pokorra, 2019-01-04 10:59

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