How To Install Redmine on Ubuntu 16.04

How To Install Redmine on Ubuntu 16.04

In this guide we will show you, how to install Redmine on Ubuntu 16.04. Redmine is an open source cross-platform and cross-database issue tracking, and web-based project management application built on top on the Ruby on Rails framework. This guide should work on other Linux VPS systems as well but was tested and written for Ubuntu 16.04 VPS. Installing Redmine on Ubuntu 16.04, is quite easy task, if you carefully follow our tutorial below.

1. Update the system and install necessary packages

sudo apt update
sudo apt 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

2. Install MySQL and create database

To install the MySQL package, run:

sudo apt install mysql-server

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

mysql_secure_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)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

3. 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

Switch to the new redmine user:

sudo su - redmine

4. Install Ruby using RVM

curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby

To start using RVM run the following commands:

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

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

ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

5. Install Redmine

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

cd && svn co http://svn.redmine.org/redmine/branches/3.4-stable 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

Open the database.yml file and update username/password

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
nano ./redmine/config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine_passwd"
  encoding: utf8

6. Install Gems

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

7. Prepare the database

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

8. Puma configuration

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/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 "tcp://0.0.0.0:9000"

9. Start Puma

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: 16
* Environment: production
* Daemonizing...

Finally your can start your browser and access your new Redmine installation at: http://IP_ADDRESS:9000

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 Install Redmine on Ubuntu 16.04, if you use one of our Redmine 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. For more updates, you can also read our post on How to Install Redmine on Ubuntu 18.04.

PS. If you liked this post , on how to install Redmine on Ubuntu 16.04, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

3 thoughts on “How To Install Redmine on Ubuntu 16.04”

    • You can create a systemd unit. For more information please check: https://github.com/puma/puma/blob/master/docs/systemd.md

      Reply

Leave a Comment