Install Mantis Bug Tracker on Ubuntu 20.04|18.04

Posted on 10 views

Welcome to our guide on how to install Mantis Bug Tracker on Ubuntu 20.04|18.04. MantisBT is an open source web-based bug tracking system which has matured and gained a lot of popularity to become one of the most popular open source bug/issue tracking systems. MantisBT is developed in PHP, with support for multiple database backends including MySQL, MS SQL and PostgreSQL.

MantisBT on Ubuntu Software Requirements

  • MySQL 5.5.35+, PostgreSQL 9.2+, or other supported database
  • PHP 5.5.9+
  • Apache / Nginx web server

You’ll need to ensure that above software requirements are installed before downloading MantisBT.

Step 1: Install Apache2, PHP and Database Server

In this section, we’ll ensure all dependencies are installed. Let’s start with the installation of PHP:

sudo apt update
sudo apt install vim wget php php-cli php-fpm php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath

Then install Apache2 Web Server

sudo apt -y install apache2

For a Database, you can choose to use MySQL or MariaDB. In this guide we’re using MariaDB database server:

sudo apt update
sudo apt install mariadb-server mariadb-client

Update authentication plugin for root user:

$ sudo mysql -u root
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE User = 'root';
FLUSH PRIVILEGES;
QUIT;

Secure database server:

$ sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Login to the MariaDB shell:

$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 59
Server version: 10.3.31-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Create a database and user for MantisBT:

CREATE USER 'mantisbt'@'localhost' IDENTIFIED BY 'StrongPassword';
CREATE DATABASE mantisbt;
GRANT ALL PRIVILEGES ON mantisbt.* TO 'mantisbt'@'localhost';
FLUSH PRIVILEGES;
QUIT

Check if you can log in to Database shell as mantisbt user:

$ mysql -u mantisbt -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 42
Server version: 10.3.31-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mantisbt           |
+--------------------+
2 rows in set (0.00 sec)

Step 2: Download and Install Mantis Mantis Bug Tracker on Ubuntu 20.04|18.04

Check for the latest release of Mantis Bug Tracker from Github.

Download it locally to your Ubuntu host

export VER="2.25.2"
wget https://sourceforge.net/projects/mantisbt/files/mantis-stable/$VER/mantisbt-$VER.tar.gz

Uncompress the package

tar xvf mantisbt-$VER.tar.gz

Move the folder to /srv directory

sudo mv mantisbt-$VER/ /srv/mantisbt

Set proper permissions for the directory

sudo chown -R www-data:www-data /srv/mantisbt/

Create Apache Virtual Host file for Mantis Bug Tracker

sudo vim /etc/apache2/sites-enabled/mantisbt.conf

Paste below content into the file


        ServerAdmin [email protected]
        DocumentRoot "/srv/mantisbt"
        ServerName bt.example.com
        ServerAlias www.bt.example.com
        ErrorLog "/var/log/apache2/mantisbt-error_log"
        TransferLog "/var/log/apache2/mantisbt-access_log"
        /srv/mantisbt/">
                DirectoryIndex index.php index.html
                Options FollowSymLinks
                AllowOverride None
                Require all granted
                Options MultiViews FollowSymlinks
        

Where:

  • bt.example.com is the domain name to be used
  • /srv/mantisbt/ is the directory containing Mantis extracted data
  • [email protected] is the domain admin email address

Check for syntax errors

$ sudo apachectl -t
Syntax OK

If you get the Syntax OKmessage, restart Apache service

sudo systemctl restart apache2

A check on service status should indicate running

$ systemctl status apache2
 apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           `-apache2-systemd.conf
   Active: active (running) since Sun 2018-11-04 06:48:42 PST; 4s ago
  Process: 20227 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 20232 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 20257 (apache2)
    Tasks: 6 (limit: 1111)
   CGroup: /system.slice/apache2.service
           |-20257 /usr/sbin/apache2 -k start
           |-20262 /usr/sbin/apache2 -k start
           |-20263 /usr/sbin/apache2 -k start
           |-20264 /usr/sbin/apache2 -k start
           |-20265 /usr/sbin/apache2 -k start
           `-20266 /usr/sbin/apache2 -k start

Nov 04 06:48:42 ubuntu-01 systemd[1]: Starting The Apache HTTP Server...
Nov 04 06:48:42 ubuntu-01 systemd[1]: Started The Apache HTTP Server.

Step 3: Finish Mantis Bug Tracker Installation

Open the URL http://bt.example.com to finish your Mantis Bug Tracker installation on Ubuntu 20.04/18.04.

Configure Database

Under Installation Options fill:

  • Type of Database: MySQL Improved
  • Username (for Database): mantisbt
  • Password (for Database): StrongPassword
  • Database name (for Database): mantisbt

Then click on “Install/Upgrade” Database” button. If the installation was successful, you should receive a message like below

Install-Mantis-Bug-Tracker-Ubuntu-18.04-successful-1024x80

Login to Mantis Bug Tracker Dashboard

Default Logins are:

Username: administrator
Password: root

Install-Mantis-Bug-Tracker-Ubuntu-18.04-login-02-1024x566

Please change the administrator password after the first login

Install-Mantis-Bug-Tracker-Ubuntu-18.04-change-admin-password-min-1024x627

Cheers!. You have successfully installed Mantis Bug Tracker on Ubuntu 20.04|18.04 server. Explore more settings and don’t forget to check the official Mantis Bug Tracker Administration guide.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.