Content

Introduce and Configure Redmine on Debian 9

Redmine incorporates different venture support, wikis, framework following issues, discussions, schedules, email notices, and considerably more. We'll show you how to install and customize the new version of Redmine on Debian 9 in this tutorial.

Before you start make sure to do this

  • Have a domain name pointing to a public IP on your server. We're going to utilize example.com. 
  • Signed in as a sudo-favoured client. 
  • Introduced. Nginx 
  • Have a Domain SSL declaration introduced. 

 

Make a My SQL database

Redmine underpins MySQL/MariaDB, SQL Server, SQLite 3, Microsoft and PostgreSQL. We will utilize MariaDB as back-end to the database. Check that you have introduced at any rate MySQL 5.7 or MariaDB 10.3 on your PC. 

In the event that your Debian server doesn't have MariaDB or MySQL, you can introduce it utilizing these guidelines. 

Start by signing in by composing in the MySQL support:

$ sudo mysql

To make another database, run the accompanying SQL explanation; 

mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;

Make another client represent MySQL, and permit access to the database: 

mysql> GRANT ALL ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'change-with-strong-password';

mysql> flush priviledges; <- this is important! Otherwise the changes will not apply till mysql service restart.

Remember to change a solid secret key with change-with-solid passwords.

Once done, log out of the console at MariaDB by typing:

mysql> EXIT;

 

Install Ruby

Install the latest version of Ruby by means of Rbenv or RVM.

 

RVM

1. install rvm, run it, add to autostart

curl -sSL https://get.rvm.io | sudo bash -s master
source /etc/profile.d/rvm.sh
echo '[[ -s "/etc/profile.d/rvm.sh" ]] && source "/etc/profile.d/rvm.sh"' >> ~/.bashrc

2. Create user "easy" (or you may name it as you wish, the point is, this user will work with your redmine application, not root user. It should be done for security reasons)

useradd -m -G rvm -s /bin/bash easy

Also you need to add user "easy" to sudoers group (we should allow to this user to run some commands from sudo)

usermod -a -G sudo easy

If you did this you may miss the next step, because after this command your user is in proper group already. Switch to this user

su - easy

3. add user to rvm group

usermod -a -G rvm easy

Also you need to add user "easy" to sudoers group (we should allow to this user to run some commands from sudo)

usermod -a -G sudo easy

Switch to user "easy"

su - easy

4. install ruby

rvm install 2.6 --patch railsexpress

5. install git

sudo apt-get install git

6. set ruby 2.6 as default

rvm use 2.6 --default

Part in italic is needed only if you are going to install ruby from non-root user. If you decide to leave it, you may replace user name "easy" to "redmine".

 

Rbenv

Please follow the instructions in this article.

 

Introduce Passenger and Nginx #

Passenger is a quick, lightweight Ruby, Node.js, and Python web application server that can be incorporated with Apache and Nginx. Passenger will be introduced as Nginx module. 

Installing the packages required to make an https repository:

$    sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common

Import the GPG key repository and allow the Phusionpassenger repository to:

$   sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 561F9B9CAC40B2F7

$   sudo add-apt-repository 'deb https://oss-binaries.phusionpassenger.com/apt/passenger stretch main'

Update the list of packages and install the Nginx Passenger Modul with:

$   sudo apt update

$   sudo apt install libnginx-mod-http-passenger

$   gem install passenger --no-ri --no-rdoc

$   passenger-install-nginx-module

 

Install Redmine on Debian

Start by installing the necessary dependencies to build a Redmine:

$    sudo apt install build-essential libmariadbclient-dev imagemagick libmagickwand-dev curl ruby-dev libxslt-dev libxml2-dev zlib1g-dev

You should check the Redmine download page for a newer version before proceeding with the next step.

 

Download Redmine

Use the following curl command to download the archive at Redmine:

$     sudo curl -L http://www.redmine.org/releases/redmine-4.0.4.tar.gz -o /tmp/redmine.tar.gz

Extract the archive and transfer it to /opt directory once the download is complete:

$  cd /tmp

$  sudo tar zxf /tmp/redmine.tar.gz

$  sudo mv /tmp/redmine-4.0.4 /opt/redmine

Configure Redmine Database:

Copy the configuration file for an example in Redmine:

$     sudo cp /opt/redmine/config/database.yml.example /opt/redmine/config/database.yml

Open your Text editor file:

$    sudo nano /opt/redmine/config/database.yml

Search the production section, and enter the previously created MySQL database and user information:

/opt/redmine/config/database.yml

Production:

  adapter: mysql2

  database: redmine

  host: localhost

  username: redmine

  password: "change-with-strong-password"

  encoding: utf8

Save the file until done, and exit the editor.

 

Install Ruby conditions

Install bundler and other Ruby conditions and explore to the Redmine catalogue:

$ cd path/to/redmine/

$ sudo gem install bundler

$ sudo bundle install -- without development test

Relocate the database by Generating Keys:

Run the accompanying key age order, and relocate the database.

$ sudo bundle exec rake generate_secret_token

$ sudo RAILS_ENV=production bundle exec rake db:migrate

 

Set the correct approvals

Nginx runs as a client and network of the www-information. Set authorizations accurately by giving the accompanying chown order.

$    sudo chown -R www-data: /opt/redmine/

 

Setup Nginx

Note: In this blog, you can learn more about letsencrypt as well as an alternative way to create/purchase HTTPS certificates (cert-manager). We also recommend reading this documentation post.

By now, if you don't check the prerequisites for this tutorial you should already have Nginx with SSL certificate installed on your system. 

Open your Text Editor and create the following block file for Nginx server:

$    sudo nano /etc/nginx/sites-available/example.com

/etc/nginx/sites-available/example.com

# Redirect HTTP -> HTTPS

server {

    listen 80;

    server_name www.example.com example.com;

    include snippets/letsencrypt.conf;

    return 301 https://example.com$request_uri;

}

# Redirect WWW -> NON WWW

server {

    listen 443 ssl http2;

    server_name www.example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

    include snippets/ssl.conf;

    return 301 https://example.com$request_uri;

}

server {

    listen 443 ssl http2;

    server_name example.com;

    root /opt/redmine/public;

    # SSL parameters

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

    include snippets/ssl.conf;

    include snippets/letsencrypt.conf;

    # log files

    access_log /var/log/nginx/example.com.access.log;

    error_log /var/log/nginx/example.com.error.log;

    passenger_enabled on;

    passenger_min_instances 1;

    client_max_body_size 10m;

}

Don't forget to use your Redmine domain to replace example.com and set the correct path to the SSL certificate files. All requests for HTTP will be forwarded to HTTPS. This guide generates the snippets used in this setup.

Enable the block server by creating a symbolic link to the directory-enabled for the sites:

$    sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

Make a test before restarting the Nginx service to be sure there are no syntax errors: 

$  sudo nginx -t

If no errors occur then the output should look like this: 

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

Finally, restart the service with Nginx by type in:

$  sudo systemctl restart nginx

 

Access Redmine

Open your browser, type your domain, and if the installation is successful, a similar screen will appear as follows: 

Redmine 's default login credentials are to: 

User name: admin

Password: admin

When you first sign in, you'll be prompted to change your password as shown below: 

Once the password is changed you will be redirected to the user account page.

You built Redmine on your Debian system with success.

 

Author: Adnan Gohar, Lukáš Beňa

Additional information
Free Trial

Easy Redmine 10 upgrade
Top plugins & features
New & mobile design
Server upgrades
Global cloud

Start Free Trial

Try Easy Redmine in a 30-day free trial

Full-featured, 30 Days, SSL protected, Daily Backups, In your Geo Location

or