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