Install Redmine on an Ubuntu 14.04 server with MariaDB, Puma and Nginx.

In this tutorial, we will explain how to install Redmine 2.6 on an Ubuntu 14.04 VPS with MariaDB, Puma and Nginx. Redmine is a flexible open source issue tracking and web-based project management application . Redmine is built on Ruby on Rails framework and it is cross-platform and cross-database. This guide should work on other Linux VPS systems as well but was tested and written for Ubuntu 14.04 VPS.

Login to your VPS via SSH

ssh user@myVPS

Update the system and install necessary packages

user@myVPS:~# sudo apt-get update && sudo apt-get -y upgrade
user@myVPS:~# sudo apt-get install python-software-properties \
    curl autoconf subversion bison software-properties-common \
    imagemagick libmagickwand-dev build-essential libssl-dev \
    libreadline-dev libyaml-dev zlib1g-dev git openssl vim

Install MariaDB 10.0

user@myVPS:~# sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
user@myVPS:~# sudo add-apt-repository 'deb http://mirror.pw/mariadb/repo/10.0/ubuntu trusty main'
user@myVPS:~# sudo apt-get install mariadb-server libmariadbclient-dev

When the installation is complete, run the following command to secure your installation:


Next, we need to create a database for our Redmine installation:

mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'redmine_passwd';
MariaDB [(none)]> \q

Redmine user

Create a new system user for Redmine.

user@myVPS:~# sudo adduser --home /opt/redmine --shell /bin/bash --gecos 'Redmine application' redmine
user@myVPS:~# sudo install -d -m 755 -o redmine -g redmine /opt/redmine
user@myVPS:~# sudo usermod -a -G sudo redmine
user@myVPS:~# sudo su - redmine

Install Ruby using RVM

redmine@myVPS:~# cd
redmine@myVPS:~# curl -sSL https://rvm.io/mpapis.asc | gpg --import -
redmine@myVPS:~# curl -sSL https://get.rvm.io | bash -s stable --ruby

To start using RVM run

redmine@myVPS:~# source ~/.rvm/scripts/rvm

To verify everything is done correctly, use the command ruby --version.
The output should be similar to the following:

redmine@myVPS:~# ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]

Install Redmine

The following commands will checkout the Redmine source code to the ~/redmine directory and create some directories.

redmine@myVPS:~# cd && svn co http://svn.redmine.org/redmine/branches/2.6-stable redmine
redmine@myVPS:~# mkdir -p ./redmine/tmp/pids ./redmine/public/plugin_assets

Configure database settings

redmine@myVPS:~# cp ./redmine/config/configuration.yml.example ./redmine/config/configuration.yml
redmine@myVPS:~# cp ./redmine/config/database.yml.example ./redmine/config/database.yml

Open the database.yml file and update username/password

redmine@myVPS:~# vim ./redmine/config/database.yml
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine_passwd"
  encoding: utf8

Create a new Puma configuration file.

redmine@myVPS:~# vim ./redmine/config/puma.rb
#!/usr/bin/env puma

application_path = '/opt/redmine/redmine'
directory application_path
environment 'production'
daemonize true
pidfile "#{application_path}/tmp/pids/puma.pid"
state_path "#{application_path}/tmp/pids/puma.state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
bind "unix://#{application_path}/tmp/sockets/redmine.sock"

Install Gems

redmine@myVPS:~# cd /opt/redmine/redmine
redmine@myVPS:~# echo "gem 'puma'" >> Gemfile.local
redmine@myVPS:~# echo "gem: --no-ri --no-rdoc" >> ~/.gemrc 
redmine@myVPS:~# bundle install --without development test postgresql sqlite

Prepare the database

redmine@myVPS:~# rake generate_secret_token
redmine@myVPS:~# RAILS_ENV=production rake db:migrate
redmine@myVPS:~# RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data

Create an Upstart script

redmine@myVPS:~# sudo vim /etc/init/redmine.conf
description "Puma Redmine Service"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
setuid redmine
setgid redmine
exec /bin/bash << EOT
source /opt/redmine/.rvm/scripts/rvm
cd /opt/redmine/redmine
bundle exec puma --config config/puma.rb
end script

You can now start your Redmine service  with :

redmine@myVPS:~# sudo service redmine start

Install and configure Nginx

Installing Nginx is pretty easy, just run the following command:

redmine@myVPS:~# sudo apt-get install nginx

Next, create a new Nginx server block:

redmine@myVPS:~# sudo vim /etc/nginx/sites-available/redmine.domain.com
upstream redmine {
  server unix:/opt/redmine/redmine/tmp/sockets/redmine.sock;

server {
  server_name redmine.domain.com;
  root /opt/redmine/redmine;

  location / {
    try_files $uri @ruby;

  location @ruby {
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header  Host $http_host;
    proxy_redirect off;
    proxy_read_timeout 300;
    proxy_pass http://redmine;

Activate the server block by creating a symbolic link and restart Nginx:

user@myVPS:~# sudo ln -s /etc/nginx/sites-available/redmine.domain.com /etc/nginx/sites-enabled/redmine.domain.com
user@myVPS:~# sudo service nginx restart

That’s it. You have successfully installed Redmine on your Ubuntu VPS. For more information about Redmine, please refer to the Redmine website.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Categories: Tutorials