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