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