i Install and configure redmine on ubuntu server 16.04 – All things in moderation

Install and configure redmine on ubuntu server 16.04

Introduction

Redmine is a free and open source, web-based project management and issue tracking tool. It allows users to manage multiple projects and associated subprojects. It features per project wikis and forums, time tracking, and flexible, role-based access control. It includes a calendar and Gantt charts to aid visual representation of projects and their deadlines. Redmine integrates with various version control systems and includes a repository browser and diff viewer.

In this tutorial, I will guide you how to install and configure redmine on ubuntu server 16.04.

1. Install requirements

sudo apt install build-essential mysql-server ruby ruby-dev libmysqlclient-dev imagemagick libmagickwand-dev  -y
sudo gem install bundler

2. Setup Database MySQL

sudo mysql -u root -p
CREATE DATABASE redmine CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;
exit

3. Setting up redmine

**3.1. Download redmine: **
Download redmine from: https://www.redmine.org/projects/redmine/wiki/Download

cd /~
wget https://www.redmine.org/releases/redmine-3.4.6.tar.gz
tar -xzvf redmine-3.4.6.tar.gz
mv redmine-3.4.6 redmine
cd redmine

3.2. Configure redmine

– Create redmine config file:

cp config/database.yml.example config/database.yml
cp config/configuration.yml.example config/configuration.yml

– Config mysql in config/database.yml config file: ** vi config/database.yml**:

production:
    adapter: mysql2
    database: redmine
    host: localhost
    port: 3306
    username: redmine
    password: "your_password"

– Config mail server (gmail, zoho mail, …) in config/configuration config file: **vi config/configuration.yml** :

production:
    email_delivery:
        delivery_method: :smtp
        smtp_settings:
            enable_starttls_auto: true
            address: "smtp.gmail.com" 
            port: 587
            domain: "smtp.gmail.com" 
            authentication: :login
            user_name: "[email protected]" 
            password: "your_password"

3.3. Change permission in redmine folder:

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

3.4. Dependencies installation

# Dependencies installation
gem install bundler
bundle install --without development test

#  Session store secret generation
bundle exec rake generate_secret_token

#  Database schema objects creation
RAILS_ENV=production bundle exec rake db:migrate

# Database default data set
RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data

3.5. Install SCM tools:

sudo apt install subversion  darcs  mercurial  darcs bzr git -y

3.6. Start redmine server

cd /path/to/redmine/
bundle exec rails server webrick -e production

Running service as background with following command:

(setsid bundle exec rails server webrick -e production &)

After start redmine running on localhost:3000.

3.6. Admin Login Default:
Login to redmine administrator with default user (need to change user password after login):

– login: admin

– password: admin

4. Install and config Nginx as reverse proxy

redmine default running on localhost:3000. We need to install nginx as a reverse proxy to configure to a global domain.

sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx

**Config nginx: **

– Create file config :

touch /etc/nginx/conf.d/redmine.conf

– Edit the redmine.conf config file :

server {

    listen  80 ;
    server_name  redmine.yourdomain.com;

    access_log  /var/log/nginx/redmine.access.log combined;
    error_log     /var/log/nginx/redmine.error.log      error;

    location / {
            proxy_pass http://127.0.0.1:3000/;
            proxy_redirect default;
    }


    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
         root   /usr/share/nginx/html;
    }

}

Comment include /etc/nginx/sites-enabled/*; in /etc/nginx/nginx.conf file:

Restart nginx :

sudo service nginx restart

5. BACKUP & RESTORE

1. Backup

# Database: mysqldump -u redmine -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%Y-%m-%d`.gz

mysqldump -u redmine -pyour_password redmine> /home/ubuntu/backup/redmine.sql

# Attachments: rsync -a /path/to/redmine/files /path/to/backup/files

rsync -a /home/ubuntu/redmine/files /home/ubuntu/backup/files

# Compress backup file
cd /home/ubuntu/backup/
tar -czvf redmine_`date +%Y-%m-%d`.gz files redmine.sql

2. Restore

– Download and install redmine with database restored from backup file:

mysql -u username --password redmine_database < redmine.sql

– Copy files folder to redmine folder

Reference

http://www.redmine.org/projects/redmine/wiki/Installation_Guide

Leave a Reply