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