Install Redmine with MariaDB on Debian 10 Buster

|
Last Updated:
|
|

In this guide, you will learn how to install Redmine with MariaDB on Debian 10 Buster. Redmine is cross-platform and cross-database, flexible project management written on Ruby on Rails Framework.

Some of the main features of Redmine are:

  • Multiple projects support
  • Flexible role based access control
  • Flexible issue tracking system
  • Gantt chart and calendar
  • News, documents & files management
  • Feeds & email notifications
  • Per project wiki
  • Per project forums
  • Time tracking
  • Custom fields for issues, time-entries, projects and users
  • SCM integration (SVN, CVS, Git, Mercurial and Bazaar)
  • Issue creation via email
  • Multiple LDAP authentication support
  • User self-registration support
  • Multilanguage support
  • Multiple databases support

Read more about Redmine features on the features page.

Install Redmine with MariaDB on Debian 10 Buster

Run system update

To begin with, ensure that your system packages are up-to-date.

apt update

Install Required Build Tools and Dependencies

To install Redmine from the source code, you need install the required build tools and dependencies.

apt install build-essential ruby-dev libxslt1-dev libmariadb-dev libxml2-dev zlib1g-dev imagemagick libmagickwand-dev curl vim sudo

Install Apache HTTP Server on Debian 10 Buster

Redmine is a web application and hence you need to install a web server to access it.

apt install apache2

Next, install the APache modules for the Passenger, lightweight web server for Ruby.

apt install libapache2-mod-passenger

The above command will also install other required dependencies including Ruby.

ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]

Start and enable Apache to run on system boot.

systemctl enable --now apache2

Create Redmine System User

While installing the Redmine Ruby dependencies, you need to run the bundler command as non-privileged user. In this setup, we use redmine user.

Hence, create a redmine user and assign the Redmine installation directory, /opt/redmine as its home directory.

useradd -r -m -d /opt/redmine -s /usr/bin/bash redmine

Add Apache user to Redmine group.

usermod -aG redmine www-data

Install MariaDB on Debian 10 Buster

Follow through the guide below to install MariaDB 10 on Debian 10 Buster.

Install MariaDB 10 on Debian 10 Buster

Create Redmine Database and Database User

Once MariaDB is installed, login as root user and create Redmine database and database user. Replace the names of the database and the database user accordingly.

mysql -u root -p
create database redminedb;
grant all on redminedb.* to redmineuser@localhost identified by 'P@ssW0rD';

Reload privilege tables and exit the database.

flush privileges;
quit

Download and Install Redmine

Redmine v4.0.5 is the latest release as of this writing. Navigate Redmine releases page and grab Redmine tarball. You can simply download it by running the command below.

wget http://www.redmine.org/releases/redmine-4.0.5.tar.gz -P /tmp/

Extract the Redmine tarball to the Redmine directory.

sudo -u redmine tar xzf /tmp/redmine-4.0.5.tar.gz -C /opt/redmine/ --strip-components=1

Configuring Redmine on Debian 10

Once you have installed Redmine under the /opt/redmine directory, you can now proceed to configure it.

Create Redmine configuration file by renaming the sample configuration files as shown below;

su - redmine
cp /opt/redmine/config/configuration.yml{.example,}
cp /opt/redmine/public/dispatch.fcgi{.example,}
cp /opt/redmine/config/database.yml{.example,}

Configure Redmine Database Settings

Open the created Redmine database configuration setting and set the Redmine database connection details for MySQL.

vim /opt/redmine/config/database.yml
...
production:
  adapter: mysql2
  database: redminedb
  host: localhost
  username: redmineuser
  password: "P@ssW0rD"
  encoding: utf8
...

Install Redmine Ruby Dependencies

Exit the redmine user by pressing Ctlr+D

redmine@debian10:~$ exit

And as privileged user, navigate to Redmine install directory and install the Ruby dependencies.

cd /opt/redmine

Install Bundler for managing gem dependencies.

sudo gem install bundler

Next, install the required gems dependencies as non-privileged redmine user.

su - redmine
bundle install --without development test --path vendor/bundle

Generate Secret Session Token

To prevent tempering of the cookies that stores session data, you need to generate a random secret key that Rails uses to encode them.

bundle exec rake generate_secret_token

Create Database Schema Objects

Create Rails database structure by running the command below;

RAILS_ENV=production bundle exec rake db:migrate

Once the database migration is done, insert default configuration data into the database by executing;

RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data

Configure FileSystem Permissions

Ensure that the following directories are available on Redmine directory, /opt/redmine.

  • tmp and tmp/pdf
  • public and public/plugin_assets
  • log
  • files

If they do not exist, simply create them and ensure that they are owned by the user used to run Redmine.

for i in tmp tmp/pdf public/plugin_assets; do [ -d $i ] || mkdir -p $i; done
chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 /opt/redmine

Testing Redmine Installation

The setup of Redmine on Debian 10 is now done. Redmine listens on TCP port 3000 by default. Hence, before running the tests, open port 3000/tcp on firewall if it is running.

redmine@debian10:~$ exit
sudo ufw allow 3000/tcp

You can now test Redmine using WEBrick by executing the command below;

cd /opt/redmine
sudo bundle exec rails server webrick -e production

Navigate to the browser and enter the address, http://server-IP-or-Hostname:3000. Replace the server-IP-or-Hostname accordingly.

If all is well, you should land on Redmine web user interface.

Redmine on Debian 10 Buster

Configure Apache for Redmine

Now that you have confirmed that Redmine is working as expected, proceed to configure Apache to server Redmine.

Create Redmine Apache VirtualHost configuration file.

vim /etc/apache2/sites-available/redmine.conf
Listen 3000
<VirtualHost *:3000>
	ServerName redmine.kifarunix-demo.com
	RailsEnv production
	DocumentRoot /opt/redmine/public

	<Directory "/opt/redmine/public">
	        Allow from all
	        Require all granted
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
        CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined
</VirtualHost>

Check Apache configuration for errors.

apachectl configtest
Syntax OK

Ensure that Passenger module is loaded;

apache2ctl -M | grep -i passenger
passenger_module (shared)

If not enabled, run the command below to enable it.

a2enmod passenger

Enable Redmine site.

a2ensite redmine

Reload Apache

systemctl reload apache2

Check to ensure that Redmine is now listening on port 3000.

lsof -i :3000
apache2 32538     root    6u  IPv6 101516      0t0  TCP *:3000 (LISTEN)
apache2 32647 www-data    6u  IPv6 101516      0t0  TCP *:3000 (LISTEN)
apache2 32648 www-data    6u  IPv6 101516      0t0  TCP *:3000 (LISTEN)
apache2 32649 www-data    6u  IPv6 101516      0t0  TCP *:3000 (LISTEN)
apache2 32650 www-data    6u  IPv6 101516      0t0  TCP *:3000 (LISTEN)
apache2 32651 www-data    6u  IPv6 101516      0t0  TCP *:3000 (LISTEN)

Access Redmine on Browser

Next, you can now access and sign in to Redmine on browser using the address http://server-IP-address:3000. Default credentials: admin:admin.

Redmine on Debian 10

Reset the password.

Redmine on Debian 10 Buster

Set your profile.

Redmine Debian 10 Buster

Click Save to effect the changes.

You can now navigate through Redmine. Read more on Redmine User guide.

That is all on how to install Redmine with MariaDB on Debian 10 Buster.

Read more about Redmine installation by following the links below;

Install Redmine with Apache and MySQL 8 on Fedora 30/29/31

Install Redmine with Apache and MariaDB on CentOS 8

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

4 thoughts on “Install Redmine with MariaDB on Debian 10 Buster”

  1. Hi,
    In order to use the useradd command I had to modify the /root/.bashrc file. In the file I added the following: export PATH=”$PATH:/usr/sbin/”. After saving the file, I executed the source /root/.bashrc command.

    Reply
  2. Hi frend.
    useradd user & passwd userpassword
    +
    sudo a2dissite 000-default.conf
    sudo service apache2 restart

    afte wrait config apache2

    Reply
  3. Hello, just for information, no big deal but the “/admin” is missing in the said url to access the admin connection.

    Anyway thanks a lot for the tutorial.

    Reply

Leave a Comment