Mantis is an open-source PHP-based bug tracking tool developed to provide efficiency and simplicity to track the software defect as well as project management. It supports various database backends which include Mysql, MS-SQL, and Postgresql.

I am using Nginx Web Server instead of Apache. The installation steps in this tutorial were performed on the Ubuntu 20.04 LTS system.

Nginx Installation on Ubuntu

$ sudo apt update
$ sudo apt install nginx -y

Next, then allow the Nginx default port to your firewall using the command mentioned below.

$ sudo ufw allow http
$ sudo ufw allow https

Make sure your Nginx is running on the system using the systemctl daemon.

$ systemctl status nginx

Mysql Installation and configuration

You can install MySQL using the apt command in the following way. In this setup, we will be using MySQL 8 as our database backend.

$ sudo apt update
$ sudo apt installation mysql-server

Once you installed the mysql you need to update the root user authentication plugin to be able to login with password so execute,

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

Next, you need to perform a mysql secure installation. In this process you can set the root user’s strong password as well as disable root access outside the localhost and other security-related configurations to make mysql secure. To start the process execute the following command.

$ sudo mysql_secure_installation

When you execute the above command you will be prompted to secure the installation process, then finish up the installation process.

Now, create a database and set up a user for the database in MySQL using the following steps.

$ sudo mysql

Create a database for mantis.

mysql > CREATE DATABASE mantisdb;

Create a new user and grant the user all privileges of mantisdb using the following command in mysql CLI.

mysql > CREATE USER 'mantis_user'@'localhost' IDENTIFIED BY 'securepassword';

Replace the word securepassword with a secure password of your choice in the above command. Then to grant privileges run,

mysql > GRANT ALL PRIVILEGES ON mantisdb.* TO 'mantis_user'@'localhost';
mysql > FLUSH PRIVILEGES;

Now, your database setup is completed.

PHP & Its Related Packages

As Mantis is a PHP-based project so you need to install the PHP and all its dependent packages using the following apt command.

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

Now, verify the PHP installation by checking its version.

$ php -v

How to Install Mantis Bug Tracking System with Nginx on Ubuntu 20.04 linux ubuntu

PHP Version.

Configuring & Deploying the Mantis to Nginx Web Server

Once the LAMP stack has been set up you can now download the latest mantis project file from its official page using the wget command.

$ wget https://udomain.dl.sourceforge.net/project/mantisbt/mantis-stable/2.25.2/mantisbt-2.25.2.tar.gz

Now extract the downloaded project using the command mention below

$ tar -xvzf mantisbt-2.25.2.tar.gz

Next, move the file to the following directory.

$ sudo mv mantisbt-2.25.2 /var/www/html/mantis

Then, change the required permissions and ownership for the project files.

$ sudo chown -R www-data. /var/www/html/mantis
$ sudo chmod -R 755 /var/www/html/mantis/

To set up the virtual host on Nginx, create a new configuration file for the mantis using the following command.

$ sudo vim /etc/nginx/conf.d/mantis.conf

Now, copy-paste the following configuration to your and change accordingly if you have setup differently.

server {
  listen 80;
  server_name _;
  access_log /var/log/nginx/mantis-access.log;
  error_log /var/log/nginx/mantis-error.log;
  error_page 404 =200 /error.html;
  root /var/www/html/mantis;
  index index.php;
  location / {
     try_files $uri /index.php$is_args$args;
  }

  location ~ .php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    include fastcgi_params;
  }
}

Now, restart or reload Nginx using the systemctl daemon to apply the changes.

$ sudo systemctl reload nginx

Finally, you can browse the mantis using your configured domain or localhost or your system IP. In this demo, I have deployed in the local system so I will be accessing it through localhost. You will find the following initial setup page where you will establish the database connection.

How to Install Mantis Bug Tracking System with Nginx on Ubuntu 20.04 linux ubuntu

Once you fill the all the required fields click on the install/Update database button to configure the database and establish a database connection.

How to Install Mantis Bug Tracking System with Nginx on Ubuntu 20.04 linux ubuntu

When mantis establishes the database connection and creates the necessary tables and users, you see the following interface with Good status on every configuration check. At the end, you can see the continue button, click on it to redirect to the login page.

How to Install Mantis Bug Tracking System with Nginx on Ubuntu 20.04 linux ubuntu

You will see the login page where you need to type ‘administrator’ in the text field and click on login.

How to Install Mantis Bug Tracking System with Nginx on Ubuntu 20.04 linux ubuntu

Now, type ‘root’ for password and click on login.

How to Install Mantis Bug Tracking System with Nginx on Ubuntu 20.04 linux ubuntu

On your first login, you must update the password, email, and name.

How to Install Mantis Bug Tracking System with Nginx on Ubuntu 20.04 linux ubuntu

When you update the password and other related data you can see the following dashboard interface containing left sidebar, top-navbar and container in the middle.

How to Install Mantis Bug Tracking System with Nginx on Ubuntu 20.04 linux ubuntu

Conclusion

Finally, you have completed the installation process where you install the LAMP stack, Nginx, and deploy the mantis bug tracker on Ubuntu 20.04 LTS. I hope this guide is helpful for your mantis deployment.