Install Redmine 3 on CentOS 7 with Nginx as web server

Redmine 3 on CentOS 7


Redmine is a web application for project management, written entirely using Ruby on Rails, and released under the terms of GPLv2.
Some of its features include:

  • Multiple projects support.
  • Flexible issue tracking system.
  • Documents, news, and files management.
  • Per project wiki.
  • Per project forums.
  • SCM integration.
  • Multiple LDAP authentication support.

Getting started

First of all, there are a lot of dependencies required. On the server, execute the command:

# yum install zlib-devel patch curl-devel ImageMagick-devel openssl-devel httpd-devel
libtool apr-devel apr-util-devel bzip2 mysql-devel ftp wget gcc-c++ autoconf readline 
readline-devel zlib libyaml-devel libffi-devel make automake bison iconv-devel 

Install Ruby

Redmin 3.2.x requires Ruby 2.2. So, first you’ll want to install Ruby Version Manager which allows managing of multiple ruby environments.

# gpg2 --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
# curl -L | bash -s stable --ruby=2.2.5

The last command will download and execute a BASH script for installing and configuring Ruby 2.2.5.

This will take some time. Once it is complete, execute the following commands for adding rvm to the .bashrc file and reload automatically.

# source /usr/local/rvm/scripts/rvm

Next, edit


adding the following lines:

[[ -s "/usr/local/rvm/scripts/rvm" ]]
source "/usr/local/rvm/scripts/rvm"



Next, check Ruby and RVM versions:

# ruby -v

which, in my case, gives the output:

ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]


# rvm -v

which gives the output:

rvm 1.28.0 (latest) by Wayne E. Seguin <>, Michal Papis <> []

Configure MySQL

First, install (if not yet present) MySQL

# rpm -Uvh
# yum repolist
# yum install mysql-server

Run it:

# systemctl start mysqld

During installation process, MySQL generated a temporary password, which is stored in


; access it:

# grep 'temporary password' /var/log/mysqld.log

It will return a temporary password, which will be used for logging into mysql shell:

# mysql -u root -p


mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'my_new_strong_password';

Create a new database for Redmine:

mysql> CREATE DATABASE redmine SET utf8;
mysql> CREATE USER 'redmineuser'@localhost' IDENTIFIED BY 'user_strong_password';
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmineuser'@'localhost' IDENTIFIED BY 'user_strong_password';
mysql> EXIT;

Phusion Passenger and Nginx

Phusion Passenger, as stated in its official website, is an application server that acting as a process manager, reverse proxy and by providing operations tools, enables you to quickly launch and easily maintain Ruby, Node.js, Python and Meteor apps.

Install it with the



# gem install passenger --no-ri --no-rdoc

Then, execute:

# passenger-install-nginx-module

You will be asked for some information, and then it will install Nginx. The default installation directory is


. Of course, you can change it. In it, edit



On line 23, paste the following content:

include vhost/*.conf;

Save and close the file. Next, create a


directory for Virtual Host configuration files.

# mkdir -p /opt/nginx/conf/vhost

In this directory, create a


file. The paste the following into that file:

server {
listen 80;

root /var/www/redmine/public;
passenger_enabled on;
client_max_body_size 10m; # Max attachemnt size

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;

If you want to use Nginx with


, create the file


, and then paste the following into that file:

Description=The NGINX HTTP and reverse proxy server

ExecStartPre=/opt/nginx/sbin/nginx -t
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID


After saving and exiting, you can start Nginx:

# systemctl daemon-reload
# systemctl start nginx

Install Redmine

Now, it’s possible to install Redmine in

# cd /var/www/
# svn co redmine

In the newly created


folder, execute the following commands:

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

Next, edit



adapter: mysql2
database: redmine
host: localhost
username: redmineuser
password: "user_strong_password"
encoding: utf8

Always in



# mkdir -p tmp tmp/pdf public/plugin_assets
# chown -R nobody:nobody files log tmp public/plugin_assets
# chmod -R 775 files log tmp public/plugin_assets

Next, install Bundler to manage gems dependencies:

# gem install bundler

And then:

# bundle install --without development test

Generate a secret token:

# bundle exec rake generate_secret_token

and create database structure:

# RAILS_ENV=production bundle exec rake db:migrate
# RAILS_ENV=production bundle exec rake redmine:load_default_data

After that, restart nginx and visit the domain name with a browser, in which you’ll use a Dashboard (after logging in) for creating and managing projects.

Our work is done!