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

install-redmine-on-an-ubuntu-14-04-with-mariadb-puma-and-nginxIn 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 [email protected]

Update the system and install necessary packages

[email protected]:~# sudo apt-get update && sudo apt-get -y upgrade
[email protected]:~# 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

[email protected]:~# sudo apt-key adv --recv-keys --keyserver hkp:// 0xcbcb082a1bb943db
[email protected]:~# sudo add-apt-repository 'deb trusty main'
[email protected]:~# 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.

[email protected]:~# sudo adduser --home /opt/redmine --shell /bin/bash --gecos 'Redmine application' redmine
[email protected]:~# sudo install -d -m 755 -o redmine -g redmine /opt/redmine
[email protected]:~# sudo usermod -a -G sudo redmine
[email protected]:~# sudo su - redmine

Install Ruby using RVM

[email protected]:~# cd
[email protected]:~# curl -sSL | gpg --import -
[email protected]:~# curl -sSL | bash -s stable --ruby

To start using RVM run

[email protected]:~# source ~/.rvm/scripts/rvm

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

[email protected]:~# 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.

[email protected]:~# cd && svn co redmine
[email protected]:~# mkdir -p ./redmine/tmp/pids ./redmine/public/plugin_assets

Configure database settings

[email protected]:~# cp ./redmine/config/configuration.yml.example ./redmine/config/configuration.yml
[email protected]:~# cp ./redmine/config/database.yml.example ./redmine/config/database.yml

Open the database.yml file and update username/password

[email protected]:~# vim ./redmine/config/database.yml
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine_passwd"
  encoding: utf8

Create a new Puma configuration file.

[email protected]:~# 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/"
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

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

Prepare the database

[email protected]:~# rake generate_secret_token
[email protected]:~# RAILS_ENV=production rake db:migrate
[email protected]:~# RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data

Create an Upstart script

[email protected]:~# 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 :

[email protected]:~# sudo service redmine start

Install and configure Nginx

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

[email protected]:~# sudo apt-get install nginx

Next, create a new Nginx server block:

[email protected]:~# sudo vim /etc/nginx/sites-available/
upstream redmine {
  server unix:/opt/redmine/redmine/tmp/sockets/redmine.sock;

server {
  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:

[email protected]:~# sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
[email protected]:~# 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.

Virtual Users And Domains With Sendmail
How to Install LEMP on Ubuntu 16.04
How to install PrestaShop on an Ubuntu 14.04 VPS
  • jose c.

    jose c.jose c.

    Author Reply

    Hi, your guide was very helpful to me. Tanks for that.
    I have one question. How can redmine can be restarted with this installation method. Out-there is a lot of documentation about restart redmine installed over Apache or over nginx-passenger, but in this case the installation is through puma, so there’s not much information about this. I installed some plugins and changed configuration so I need to restart redmine. Could you tell me how to do this please?

    • admin


      Author Reply

      Use the following command:
      sudo service redmine restart

  • Kamil


    Author Reply

    I followed your steps with one spin, used redmine 3.1.
    I get 100% cpu usage on vps
    any ideas why?

  • Scott


    Author Reply

    I have the same problem as Kamil (also on 3.1). Ruby locks up an entire core. Any ideas?

    • admin


      Author Reply

      Please try to update Puma to the latest version available and see if it will fix the problem.

  • art


    Author Reply

    server unix:/opt/redmine/redmine/tmp/sockets/redmine.sock;
    How do you create a socket? What should it look like? You don’t mention it. I can’t run nginx without it.
    connect() to unix:~/redmine/redmine/tmp/sockets/redmine.sock failed (2: No such file or directory)

  • art


    Author Reply

    I got it now.
    I just didn’t use the puma script as I installed it before.
    I really can’t understand why we use sockets and how they function. So if it’s not too difficult, could you explain it to me in a few words?

    Thanks. Great post.

    • admin


      Author Reply

      Unix socket is a data communications endpoint for exchanging data between processes executing on the same host operating system.


  • lizehao


    Author Reply

    How can I start redmine? when i ‘sudo service start redmine’,it print “Failed to start redmine.service: Unit redmine.service not found”!

    • admin


      Author Reply

      Most likely you haven’t created the Redmine Upstart script. To start the Redmine service you need to create the Upstart script first.


Leave a Reply to admin
Cancel Reply

Free Migration to RoseHosting. Award Winning Linux VPS Hosting with Fully Managed Support. Coupon RHBLOG50 for 50% offOrder Now