How to Install Redmine on Ubuntu 16.04

r00t March 20, 2018

Install Redmine on Ubuntu 16.04

In this tutorial we’ll learn how to install Redmine on Ubuntu 16.04. We will also install and configure its prerequisites. Redmine is an open resource cross-platform and cross-database issue tracking, and web-based project management application built on top on the Ruby on Rails framework.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Redmine on Ubuntu 16.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y
apt-get upgrade -y

Step 2. Installing all dependency and necessary packages.

apt-get install curl subversion libmysqlclient-dev libmagickcore-dev libmagickwand-dev imagemagick g++, zlib1g-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgmp-dev, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev, libgmp-dev, libreadline6-dev, libssl-dev

Step 3. Installing MariaDB.

Installing from Ubuntu default repository is a straightforward way, but this may have bit old version of MariaDB:

apt-get install mariadb-server mariadb-client

After it’s installed, MariaDB server should be automatically started. Use systemctl to check its status:

systemctl status mysql

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

Step 4. Create new system user.

Create a new system user for Redmine:

sudo adduser --home /opt/redmine --shell /bin/bash --gecos 'Redmine application' redmine
usermod -aG sudo redmine

Then, switch to the new redmine user:

sudo su - redmine

Step 5. Installing Ruby using RVM.

Install Ruby using following command:

curl -sSL | gpg --import -
curl -sSL | bash -s stable --ruby

To start using RVM run the following commands:

source ~/.rvm/scripts/rvm
rvm --default use ruby

Step 6. Installing Redmine.

First, Issue the following commands to checkout the Redmine source code to the $HOME/redmine directory and create the necessary directories:

cd && svn co redmine
mkdir -p ./redmine/tmp/pids ./redmine/public/plugin_assets

Configure database settings:

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

Next, open the database.yml file and update username/password:

### nano ./redmine/config/database.yml
 adapter: mysql2
 database: redmine
 host: localhost
 username: redmine
 password: "redmine_passwd"
 encoding: utf8

Step 7. Installing Gems.

Install Gems using following command:

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

Step 8. Configure the database for Redmine.

rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data

Step 9. Puma configuration.

First, create a new configuration file as follows:

### nano ~/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 "tcp://"

Then, start the puma server using the following command:

cd /opt/redmine/redmine/ && bundle exec puma --config config/puma.rb

The output should be similar to the following:

Puma starting in single mode...
* Version 3.11.3 (ruby 2.4.1-p111), codename: Love Song
* Min threads: 0, max threads: 18
* Environment: production
* Daemonizing...

Step 10. Accessing Redmine.

Now you can access the Redmine web install wizard in your browser by entering the domain name or http://your_ip:9000

Congratulation’s! You have successfully install and configured Redmine on your Ubuntu 16.04 LTS server. Thanks for using this tutorial for installing Redmine on Ubuntu 16.04 LTS (Xenial Xerus) system.

The Tags:

Leave a Comment

Comments are closed.