Project

General

Profile

Actions

Install Redmine 34 on RHEL74 » History » Revision 9

« Previous | Revision 9/24 (diff) | Next »
Christophe de Dinechin, 2018-02-02 12:09


Install Redmine 3.4 on RHEL7.4

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.
I also chose to install with Postgres 10 to migrate an existing instance, although I believe it works with the default Postgres 9.2.

Dependencies

Install the required packages.

% sudo yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel

Choice of database

Install your database of choice. I've mostly tested with Postgres 10.

Postgres 10

You can upgrade to Postgres 10 if you need for example to transfer an existing database.

# More recent Postgres 10
% sudo yum -y install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-1.noarch.rpm
% sudo yum install -y postgresql10-server postgresql10 postgres-devel
% export PATH=/usr/pgsql-10/bin/:$PATH
% postgresql-10-setup initdb
% sudo systemctl start postgresql-10
% sudo systemctl enable postgresql-10

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.

Like for Postgres 9, you need to add trust for local IPv6 connexions in /var/lib/pgsql/10/data/pg_hba.conf:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

Check that you can connect to the database, then create the redmine user and a redmine database:

% sudo su - postgres
% export PATH=/usr/pgsql-10/bin/:$PATH
% psql
postgres=# alter role postgres with encrypted password 'insert-your-postgres-password-here';
postgres=# create user redmine with encrypted password 'insert-your-redmine-password-here';
postgres=# create database redmine with encoding 'UTF-8' owner redmine;

If you get an error related to the encoding (I only had that on Postgres 9):

ERROR:  new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT:  Use the same encoding as in the template database, or use template0 as template.

then you should explicitly use template0:

postgres=# create database redmine with template=template0 encoding 'UTF-8' owner redmine;

Postgres 9.2.23

Postgres 9.2.23 is what you get directly when installing with yum in RHEL 7.4:

# Default Postgres 9.2.23
% sudo yum -y install postgresql postgresql-server postgresql-devel
% postgresql-setup initdb
% sudo systemctl start postgresql
% sudo systemctl enable postgresql

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:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

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.

Create user and database like in the previous section.

For MySQL / MariaDB

Installing and starting the database server

# MariaDB (formerly MySQL)
% sudo yum -y install mariadb mariadb-devel
% sudo systemctl start mariadb
% sudo systemctl enable mariadb

Then you can setup the original database:

% mysql -u root -p
MariaDB [(none)]> set password for 'root'@'localhost' = password('insert-your-password-here');
MariaDB [(none)]> create database redmine character set utf8;
MariaDB [(none)]> create user 'redmine'@'localhost' identified by 'somepass';
MariaDB [(none)]> grant all privileges on redmine.* to 'redmine'@'localhost';

Note: The rest of this setup assumes Postgres, will need to be updated with MariaDB instructions as well.

Upgrade Ruby

The default ruby is 2.0.0p648. If you keep that version, gem install passenger fails.

% sudo yum install -y gcc
% cd /usr/local/src
% wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.gz
% tar xvfz ruby-2.5.0.tar.gz
% cd ruby-2.5.0/
% ./configure
% make
% sudo make install

Verify that you have Ruby 2.5 installed after that:

% ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

Install passenger and Gem bundler:

With Ruby 2.5, we can install Passenger:

% gem install passenger
gem install passenger
Fetching: rack-2.0.3.gem (100%)
Successfully installed rack-2.0.3
Fetching: passenger-5.2.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed passenger-5.2.0
Parsing documentation for rack-2.0.3
Installing ri documentation for rack-2.0.3
Parsing documentation for passenger-5.2.0
Installing ri documentation for passenger-5.2.0
Done installing documentation for rack, passenger after 53 seconds
2 gems installed

Install Gem bundler:

% gem install bundler
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
Done installing documentation for bundler after 5 seconds
1 gem installed

Check out Redmine

Check out the version of Redmine you want, here with version 3.4:

% cd /var/www
% svn co http://svn.redmine.org/redmine/branches/3.4-stable redmine

Add a redmine user and transfer ownership of the /var/www/redmine files to it:

% useradd redmine
% chown -R redmine /var/www/redmine

Database configuration

The database configuration for Redmine is in /var/www/redmine/config/database.yml. There is a template in that directory which you can edit.

% cd /var/www/redmine/config/
% cp database.yml.example database.yml

Edit database.yml to contain the correct information regarding your installation. For Postgres:

production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: insert-your-password-here

(Note that you always have the choice of running the database in some other host than localhost)

Install dependencies using the Gem bundler

This step will look at the dependencies specified in the Gemfile:

% bundle install

You may have a message about YARD recommending you use the following command:

% yard config --gem-install-yri
Updated ~/.gemrc: 'gem: --document=yri'

Setup the production environment

Update /var/www/redmine/config/environment.rb, adding the following statement:

ENV['RAILS_ENV'] ||= 'production'

Generate a secret token:

% RAILS_ENV=production bundle exec rake generate_secret_token

Run the database migration step:

% RAILS_ENV=production bundle exec rake db:migrate

Start the server

You can now attempt to run the application:

% sudo su - redmine
% cd /var/www/redmine
% /usr/local/bin/ruby bin/rails server -b 0.0.0.0 -e production
=> Booting WEBrick
=> Rails 4.2.8 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2018-02-01 12:49:02] INFO  WEBrick 1.4.2
[2018-02-01 12:49:02] INFO  ruby 2.5.0 (2017-12-25) [x86_64-linux]
[2018-02-01 12:49:02] INFO  WEBrick::HTTPServer#start: pid=21470 port=3000

Note that you may want to open the firewall for that port using firewall-config.

Updated by Christophe de Dinechin almost 7 years ago · 9 revisions