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