How to Install MantisBT on CentOS 7

Table of Contents

Introduction

MantisBT is a free and open source web-based bug tracker system written in PHP that can be used to track software defects. It provides a simple and easy to use web-based interface for your application's bug tracking.

Some of the important features of MantisBT are listed below:

  1. Send notification via Email and RSS.
  2. Customize issue fields, notifications, and workflow.
  3. Provides powerful access control.
  4. Time tracking and source code integration.
  5. Easily integrates with other version control system.

In this tutorial, we will learn how to install MantisBT in CentOS 7 server.

Requirements

  • A server running CentOS 7.
  • A non-root user with sudo privilege.

Getting Started

First you will need to update your OS to the latest release and update the installed packages and repositories using below command:

sudo yum update -y

Once your system is up-to-date, you can proceed to the next step.

Install LAMP

Before installing MantisBT, you will need to install a LAMP stack on your system.

You can install the stack by running the following command:

sudo yum install php httpd mariadb mariadb-server php-cli php-mysqli -y

Once all the packages are installed, start the Apache and MariaDB services then enable it to start on boot with the following commands:

sudo systemctl start httpd
sudo systemctl start mariadb
sudo systemctl enable httpd
sudo systemctl enable mariadb

Please proceed to configure MariaDB.

Configure MariaDB Database

By default a new MariaDB installation is not secured, so you will need to secure it first.

To do so, run the following script:

sudo mysql_secure_installation

Answer all the questions as shown below:

Enter current password for root (enter for none): Enter
Set root password? [Y/n]: Y
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

Log into a MariaDB shell with the following command:

mysql -u root -p

Enter the root password when prompted and then create a new database for Mantis:

MariaDB [(none)]>CREATE DATABASE mantisdb;

Create a database user and password for Mantis:

MariaDB [(none)]>CREATE USER 'mantisuser'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]>GRANT ALL PRIVILEGES ON mantisdb.* TO 'mantisuser'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
MariaDB [(none)]>FLUSH PRIVILEGES;
MariaDB [(none)]>exit;

Install MantisBT

Now we can download the latest version of the MantisBT from their official website. Alternatively you can you can download it with the following command:

wget https://downloads.sourceforge.net/project/mantisbt/mantis-stable/2.5.1/mantisbt-2.5.1.zip

Once the download is complete, extract the downloaded archive with the following command:

unzip mantisbt-2.5.1.zip

Next, move the extracted directory to apache web root directory:

sudo mv mantisbt-2.5.1  /var/www/html/mantis

Next, give proper permission to the mantis directory:

sudo chown -R apache:apache /var/www/html/mantis

Configure Apache for MantisBT

You will need to configure Apache virtual host directive for Mantis. You can do this by creating /etc/httpd/conf.d/mantis.conf file.

sudo nano /etc/httpd/conf.d/mantis.conf

Add the following lines:

<VirtualHost *:80>
  ServerAdmin admin@example.com
  ServerName example.com
 DocumentRoot /var/www/html/mantis
 <Directory />
    Options FollowSymLinks
    AllowOverride All
 </Directory>
 <Directory /var/www/html/mantis>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from All
 </Directory>

 TransferLog /var/log/httpd/mantis_access.log
 ErrorLog /var/log/httpd/mantis_error.log
</VirtualHost>

Save and close the file when you are finished, then restart the Apache httpd service:

sudo systemctl restart httpd

You will need to allow incoming HTTP traffic on port 80 through firewalld. You can do this by running the following command:

sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --reload

Access MantisBT Web Interface

Once everything is setup properly, it is time to access the MantisBT web interface.

Open your favourite web browser and type the URL http://your-server-ip, you should see the Mantis installation screen as below:

Mantis Installation Screen

Provide all the necessary information such as the database username, password and the name of the database, then click on Install/Upgrade Database button, you should see the following page:

Mantis Installation Complete

Finally, click on the Continue button to log in Mantis dashboard:

Mantis Login Screen

Provide the default administrator user name as administrator and password as root, then click on Login button, you should see the Mantis default dashboard as below:

Mantis Dashboard

Once you are logged in, you will be asked to change your password. It is very important that you change the password immediately.

Summary

Congratulations! You have successfully installed Mantis on your CentOS server. You can evaluating using Mantis in your development environment to track bug. You are welcome to leave feedback in the comments section below.