Project

General

Profile

Actions

F29Installation » History » Revision 33

« Previous | Revision 33/41 (diff) | Next »
Gerd Pokorra, 2019-01-03 19:54


HowTo Install Redmine 4.0.0 on Fedora 29

This guide is not complete. It will be completed in the next two weeks.

System Requirements

It is assumed that the Server Edition is installed on the system in this guide.

Updating the System

It is recommended to install Redmine on an update system. To ensure that all installed packages are up-to-date issue the following command:

> dnf update

Installing Dependencies

A number of dependencies need to be installed:

> dnf install rubygem-bundler
> dnf install rubygem-rails

> dnf install ruby-devel rubygem-rmagick
> dnf install gcc redhat-rpm-config

> dnf groupinstall "C Development Tools and Libraries" 
> dnf groupinstall "Development Tools" 

Database adapter for PostgreSQL:

> dnf install rubygem-pg

Database adapter for MySQL:

> dnf install rubygem-mysql2

Database adapter for MS SQL:

The Fedora distribution has not ruby software package for tiny_tds. The following dependency is needed for the build:

> dnf install freetds-devel
> # Now the build should work
> bundle install --without development test

The list of dependencies may not complete. Problems of the installation or build of a compoment can be solved by installing the necessary dependency.

Obtaining Redmine (Step 1)

Get the Redmine source code by downloading the packaged release.

> dnf install wget

> mkdir /var/www
> cd /var/www

> wget http://www.redmine.org/releases/redmine-4.0.0.tar.gz
> tar xf redmine-4.0.0.tar.gz

At this guide is accepted that the location of the Redmine source code is:

/var/www/redmine-4.0.0

For example the nginx configuration refer to the path /var/www/redmine-4.0.0.

Setup a local database server (Step 2)

This section discribes the setup of a database server that will be configured to allow access from the localhost.

PostgreSQL

The followings commands are for installing the packages, initializing the database, enable and start the postgresql server, switch the user to interact with postgres, create an empty database and accompanying user.

> dnf install postgresql-server postgresql-contrib
> postgresql-setup --initdb --unit postgresql
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
>
> systemctl enable postgresql
> systemctl start postgresql
> su - postgres
> psql
psql (10.6)
Type "help" for help.

postgres=# CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_secret' NOINHERIT VALID UNTIL 'infinity';
CREATE ROLE
postgres=# CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
CREATE DATABASE
postgres=# \q
> exit

Edit the file /var/lib/pgsql/data/pg_hba.conf to specify that the client has to supply password processed with MD5 algorithm:

#host    all             all             127.0.0.1/32            ident
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
#host    all             all             ::1/128                 ident
host    all             all             ::1/128                 md5

You can check the access with the following command:

> su - postgres
> psql -h localhost -U redmine redmine

The appropriate Redmine database configuration file for local access is:

> cat /var/www/redmine-4.0.0/config/database.yml
# PostgreSQL configuration
production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: "my_secret" 
  encoding: utf8
  schema_search_path: public

If you want to use IPv4 you have to specify localhost4 as hostname.

MySQL

Install the MySQL repositry

> dnf -y install https://dev.mysql.com/get/mysql80-community-release-fc29-1.noarch.rpm

If you prefer to stick to MySQL 5.7

> dnf config-manager --set-enabled mysql57-community
> dnf config-manager --set-disabled mysql80-community

Install the MySQL server package, start the MySQL server and autostart the daemon on boot

> dnf -y install mysql-community-server
> systemctl start mysqld.service
> systemctl enable mysqld.service

Get your generated random root password you will need it at the next step.

> grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log |tail -1

Start the secure installation assistant to

  • change root password
  • remove anonymous users
  • disallow root login remotely
  • remove test database and access to it
  • reload privilege tables
> mysql_secure_installation

Creation of user and database for Redmine

> mysql -h localhost -u root -p
Enter password:
...
mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;
mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_secret';
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
mysql> \q

The appropriate Redmine database configuration file for local accessing the MySQL database is:

> cat /var/www/redmine-4.0.0/config/database.yml
# MySQL configuration
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "my_secret" 

Step 3 to Step 9

For Step 3 to Step 9 follow the generic installation instructions. Following is the overview of the commands:

> bundle install --without development test
> bundle exec rake generate_secret_token
> RAILS_ENV=production bundle exec rake db:migrate
> RAILS_ENV=production bundle exec rake redmine:load_default_data

> mkdir -p tmp tmp/pdf public/plugin_assets
> chown -R redmine:redmine files log tmp public/plugin_assets
> chmod -R 755 files log tmp public/plugin_assets

> find files log tmp public/plugin_assets -type f -exec chmod -x {} +

> bundle exec rails server webrick -e production

Firewall

Open the firewall for https:

> firewall-cmd --add-service=https
> firewall-cmd --permanent --add-service=https

Web Server

Nginx/Passenger

The Fedora nginx package do not include Passenger, so you have to build nginx with the passenger module. The guide assume that the sources are extracted under the directory /opt . The nginx software will be installed at /opt/ngnix. At the time of writting that guide this was the current stable releases of passenger and nginx:

  • passenger-6.0.0
  • nginx-1.14.2

Downloading the sources:

Passenger

> cd /opt
> wget https://s3.amazonaws.com/phusion-passenger/releases/passenger-6.0.0.tar.gz
> tar xf passenger-6.0.0.tar.gz

Nginx

> wget http://nginx.org/download/nginx-1.14.2.tar.gz
> mkdir /opt/src
> cd /opt/src
> tar xf nginx-1.14.2.tar.gz

Installing additional packages

For the build of passenger and nginx the following additional packages are needed to be installed:

> dnf install install gcc-c++ libcurl-devel openssl-devel zlib-devel

Execute the ruby script for building and installing

The simplest way to build and install the nginx web server with the passenger module is to run the script passenger-install-nginx-module.

> /opt/passenger-6.0.0/bin
> ./passenger-install-nginx-module --prefix=/opt/nginx --nginx-source-dir=/opt/src/nginx-1.14.2 --languages ruby

With the same passenger locality the installer modify the nginx configuration file /opt/nginx/conf/nginx.conf and output the same text:

  http {
      ...
      passenger_root /opt/passenger-6.0.0;
      passenger_ruby /usr/bin/ruby;
      ...
  }

Add a systemd service file

To start the nginx process during the boot add the file /usr/lib/systemd/system/nginx.service with the following content:

[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
#PIDFile=/run/nginx.pid
PIDFile=/opt/nginx/logs/nginx.pid
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /opt/nginx/logs/nginx.pid
#ExecStartPre=/usr/sbin/nginx -t
#ExecStart=/usr/sbin/nginx
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=mixed
PrivateTmp=true

[Install]
WantedBy=multi-user.target

The paths are modified to start the executable /opt/nginx/sbin/nginx.

> systemctl start nginx
> systemctl enable nginx

Nginx Configuration

For http add the two lines and comment out the four lines:

    server {
        listen       80;
...
        root         /var/www/redmine-4.0.0/public;
        passenger_enabled on;
        #location / {
        #    root   html;
        #    index  index.html index.htm;
        #}
...
       }

For https add you can use lines like this:

    # HTTPS server
    #
    server {
        listen       443 ssl;
        server_name  my_web_serv.domain;

        ssl_certificate      /etc/ssl/certs/my_web_serv.pem;
        ssl_certificate_key  /etc/ssl/private/privkey.pem;

        root         /var/www/redmine-4.0.0/public;
        passenger_enabled on;
    }

Apache

Updated by Gerd Pokorra about 5 years ago · 33 revisions