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