Project

General

Profile

Install Redmine 34 on RHEL74 » History » Version 1

Christophe de Dinechin, 2018-02-02 11:48

1 1 Christophe de Dinechin
h1. Install Redmine 3.4 on RHEL7.4
2
3
Here is a procedure that worked for me to install Redmine 3.5 on RHEL 7.4. These instructions work as for Feb 1st, 2018.
4
I also chose to install with Postgres 10 to migrate an existing instance, although I believe it works with the default Postgres 9.2.
5
6
h2. Dependencies
7
8
Install the required packages.
9
<pre>
10
% sudo yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel
11
</pre>
12
13
h2. Choice of database
14
15
Install your database of choice. I've mostly tested with Postgres 10.
16
17
h3. For MySQL / MariaDB
18
19
Installing and starting the database server
20
<pre>
21
# MariaDB (formerly MySQL)
22
% sudo yum -y install mariadb mariadb-devel
23
% sudo systemctl start mariadb
24
% sudo systemctl enable mariadb
25
</pre>
26
27
Then you can setup the original database:
28
<pre>
29
% mysql -u root -p
30
MariaDB [(none)]> set password for 'root'@'localhost' = password('insert-your-password-here');
31
MariaDB [(none)]> create database redmine character set utf8;
32
MariaDB [(none)]> create user 'redmine'@'localhost' identified by 'somepass';
33
MariaDB [(none)]> grant all privileges on redmine.* to 'redmine'@'localhost';
34
</pre>
35
36
Note: The rest of this setup assumes Postgres, will need to be updated with MariaDB instructions as well.
37
38
h3. Postgres 9.2.23
39
40
Postgres 9.2.23 is what you get directly when installing with @yum@ in RHEL 7.4:
41
<pre>
42
# Default Postgres 9.2.23
43
% sudo yum -y install postgresql postgresql-server postgresql-devel
44
% postgresql-setup initdb
45
% sudo systemctl start postgresql
46
% sudo systemctl enable postgresql
47
</pre>
48
49
I have not been able to have Redmine connect to the database without altering @/var/lib/pgsql/data/pg_hba.conf@ to have @trust@ for local IPv6 connnexions:
50
51
<pre>
52
# TYPE  DATABASE        USER            ADDRESS                 METHOD
53
54
# "local" is for Unix domain socket connections only
55
local   all             all                                     peer
56
# IPv4 local connections:
57
host    all             all             127.0.0.1/32            trust
58
# IPv6 local connections:
59
host    all             all             ::1/128                 trust
60
</pre>
61
62
I suspect this is wrong, but I don't know how to do it "right", and that's also how it's configured in the Redmine docker containers I looked at.
63
64
Check that you can connect to the database, then create the @redmine@ user and a @redmine@ database:
65
<pre>
66
% sudo su - postgres
67
% psql
68
postgres=# alter role postgres with encrypted password 'insert-your-postgres-password-here';
69
postgres=# create user redmine with encrypted password 'insert-your-redmine-password-here';
70
postgres=# create database redmine with encoding 'UTF-8' owner redmine;
71
</pre>
72
73
If you get an error related to the encoding:
74
<pre>
75
ERROR:  new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
76
HINT:  Use the same encoding as in the template database, or use template0 as template.
77
</pre>
78
79
then you should explicitly use @template0@:
80
<pre>
81
postgres=# create database redmine with template=template0 encoding 'UTF-8' owner redmine;
82
</pre> 
83
84
85
h3. Postgres 10
86
87
You can upgrade to Postgres 10 if you need for example to transfer an existing database.
88
<pre>
89
# More recent Postgres 10
90
% sudo yum -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-1.noarch.rpm
91
% yum install -y postgresql10-server postgresql10 postgres-devel
92
% postgresql-setup initdb
93
% sudo systemctl start postgresql-10
94
% sudo systemctl enable postgresql-10
95
</pre>
96
97
Note that the @postgres-devel@ package is still required for the @bundle install@ step below, and I am not sure if that step works with Postgres 10.
98
99
Like for Postgres 9, you need to add @trust@ for local IPv6 connexions in @/var/lib/pgsql/10/data/pg_hba.conf@:
100
101
<pre>
102
# TYPE  DATABASE        USER            ADDRESS                 METHOD
103
104
# "local" is for Unix domain socket connections only
105
local   all             all                                     peer
106
# IPv4 local connections:
107
host    all             all             127.0.0.1/32            trust
108
# IPv6 local connections:
109
host    all             all             ::1/128                 trust
110
</pre>
111
112
Create user and database like in the previous section.
113
114
115
h2. Upgrade Ruby
116
117
The default @ruby@ is 2.0.0p648. If you keep that version, @gem install passenger@ fails.
118
119
<pre>
120
% cd /usr/local/src
121
% wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.gz
122
% tar xvfz ruby-2.5.0.tar.gz
123
% cd ruby-2.5.0/
124
% ./configure
125
% make
126
% make install
127
</pre>
128
129
Verify that you have Ruby 2.5 installed after that: 
130
<pre>
131
% ruby -v
132
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
133
</pre>
134
135
h2. Install passenger and Gem bundler:
136
137
With Ruby 2.5, we can install Passenger:
138
<pre>
139
% gem install passenger
140
gem install passenger
141
Fetching: rack-2.0.3.gem (100%)
142
Successfully installed rack-2.0.3
143
Fetching: passenger-5.2.0.gem (100%)
144
Building native extensions. This could take a while...
145
Successfully installed passenger-5.2.0
146
Parsing documentation for rack-2.0.3
147
Installing ri documentation for rack-2.0.3
148
Parsing documentation for passenger-5.2.0
149
Installing ri documentation for passenger-5.2.0
150
Done installing documentation for rack, passenger after 53 seconds
151
2 gems installed
152
</pre>
153
154
Install Gem bundler:
155
<pre>
156
% gem install bundler
157
Fetching: bundler-1.16.1.gem (100%)
158
Successfully installed bundler-1.16.1
159
Parsing documentation for bundler-1.16.1
160
Installing ri documentation for bundler-1.16.1
161
Done installing documentation for bundler after 5 seconds
162
1 gem installed
163
</pre>
164
165
h2. Check out Redmine
166
167
Check out the version of Redmine you want, here with version 3.4:
168
169
<pre>
170
% cd /var/www
171
% svn co http://svn.redmine.org/redmine/branches/3.4-stable redmine
172
</pre>
173
174
Add a @redmine@ user and transfer ownership of the @/var/www/redmine@ files to it:
175
<pre>
176
% useradd redmine
177
% chown -R redmine /var/www/redmine
178
</pre>
179
180
181
h2. Database configuration
182
183
The database configuration for Redmine is in @/var/www/redmine/config/database.yml@. There is a template in that directory which you can edit.
184
185
<pre>
186
% cd /var/www/redmine/config/
187
% cp database.yml.example database.yml
188
</pre>
189
190
Edit @database.yml@ to contain the correct information regarding your installation. For Postgres:
191
192
<pre>
193
production:
194
  adapter: postgresql
195
  database: redmine
196
  host: localhost
197
  username: redmine
198
  password: insert-your-password-here
199
</pre>
200
201
(Note that you always have the choice of running the database in some other host than @localhost@)
202
203
h2. Install dependencies using the Gem bundler
204
205
This step will look at the dependencies specified in the @Gemfile@:
206
207
<pre>
208
% bundle install
209
</pre>
210
211
You may have a message about YARD recommending you use the following command:
212
<pre>
213
% yard config --gem-install-yri
214
Updated ~/.gemrc: 'gem: --document=yri'
215
</pre>
216
217
h2. Setup the production environment 
218
219
Update @/var/www/redmine/config/environment.rb@, adding the following statement:
220
<pre>
221
ENV['RAILS_ENV'] ||= 'production'
222
</pre>
223
224
Generate a secret token:
225
<pre>
226
% RAILS_ENV=production bundle exec rake generate_secret_token
227
</pre>
228
229
Run the database migration step:
230
<pre>
231
% RAILS_ENV=production bundle exec rake db:migrate
232
</pre>
233
234
h2. Start the server
235
236
You can now attempt to run the application:
237
<pre>
238
% sudo su - redmine
239
% cd /var/www/redmine
240
% /usr/local/bin/ruby bin/rails server -b 0.0.0.0 -e production
241
=> Booting WEBrick
242
=> Rails 4.2.8 application starting in production on http://0.0.0.0:3000
243
=> Run `rails server -h` for more startup options
244
=> Ctrl-C to shutdown server
245
[2018-02-01 12:49:02] INFO  WEBrick 1.4.2
246
[2018-02-01 12:49:02] INFO  ruby 2.5.0 (2017-12-25) [x86_64-linux]
247
[2018-02-01 12:49:02] INFO  WEBrick::HTTPServer#start: pid=21470 port=3000
248
</pre>
249
250
Note that you may want to open the firewall for that port using @firewall-config@.