UbuntuUbuntu Based

How To Install Mantis Bug Tracker on Ubuntu 24.04 LTS

Install Mantis Bug Tracker on Ubuntu 24.04

In this tutorial, we will show you how to install Mantis Bug Tracker on Ubuntu 24.04 LTS. Bug tracking systems form the backbone of successful software development projects. Among the numerous options available, Mantis Bug Tracker stands out as a powerful, open-source solution that has been serving development teams for over two decades. This comprehensive guide will walk you through installing Mantis Bug Tracker on Ubuntu 24.04 LTS, ensuring you have a robust issue tracking system ready for your projects.

What is Mantis Bug Tracker?

Mantis Bug Tracker, commonly known as MantisBT, is a free and open-source web-based bug tracking system designed to help software development teams efficiently manage bugs and feature requests. Written in PHP and supporting multiple database backends, MantisBT has established itself as a reliable solution for tracking software defects and project management tasks.

The system offers an intuitive online platform where users can report issues, monitor progress, and collaborate on projects effectively. With over 15 years of development and availability in 50 languages, MantisBT has proven its worth in diverse development environments.

Key features that make MantisBT an excellent choice include customizable fields for issue creation and workflow management, release management capabilities, email-driven notifications, comprehensive dashboard functionality, and user-based access levels that allow different permissions for various projects. The system also supports numerous plugins and provides detailed bug history tracking, recording every modification from creation to closure.

Prerequisites and System Requirements

Before beginning the installation process, ensure your Ubuntu 24.04 LTS system meets the necessary requirements. Your server should have at least 1GB of RAM, though 2GB or more is recommended for production environments. Storage requirements depend on your expected data volume, but allocating at least 10GB ensures adequate space for the application and database growth.

MantisBT requires a configured web server, PHP programming language interpreter, and a supported relational database management system. As of the current stable branch, MantisBT requires PHP 7.0 or later, though PHP 8.1 or newer is recommended for optimal performance and security.

Essential PHP extensions include the mysqli extension for MySQL database connectivity, which is mandatory for database operations. Additional extensions enhance functionality and performance, making them worth installing during the setup process.

You’ll need root or sudo privileges on your Ubuntu system to install packages and configure services. Network connectivity is essential for downloading packages and accessing the web interface. If you plan to use a custom domain, ensure proper DNS configuration or hosts file entries are in place.

System Preparation and Initial Setup

Start by updating your Ubuntu 24.04 LTS system to ensure all packages are current. Open your terminal and execute the following commands:

sudo apt update
sudo apt upgrade -y

Install essential utilities that will be needed throughout the installation process:

sudo apt install software-properties-common wget unzip curl -y

Configure the UFW firewall to allow HTTP and HTTPS traffic while maintaining system security:

sudo ufw enable
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

These commands ensure your system can receive web traffic while maintaining secure SSH access for administration.

Web Server Installation and Configuration

Installing Apache Web Server

Apache remains one of the most popular web servers for hosting PHP applications like MantisBT. Install Apache on your Ubuntu system using the following commands:

sudo apt update
sudo apt install apache2 -y

Once Apache installation completes, manage the service using systemctl commands:

sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl status apache2

Verify Apache is running correctly by opening your web browser and navigating to http://localhost or your server’s IP address. You should see the Apache2 Ubuntu Default Page, confirming successful installation.

Alternative: Installing Nginx Web Server

For users preferring Nginx, this high-performance web server offers excellent scalability and low resource usage. Install Nginx with these commands:

sudo apt update
sudo apt install nginx -y

Start and enable Nginx services:

sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx

Test Nginx installation by browsing to http://localhost. The “Welcome to nginx!” page indicates successful installation.

Configuring Virtual Hosts

Create a virtual host configuration for MantisBT. For Apache users, create the configuration file:

sudo nano /etc/apache2/sites-available/mantisbt.conf

Add the following configuration:

<VirtualHost *:80>
    ServerAdmin admin@yourdomain.com
    DocumentRoot /var/www/html/mantisbt
    ServerName mantisbt.yourdomain.com
    ServerAlias www.mantisbt.yourdomain.com
    
    ErrorLog /var/log/apache2/mantisbt-error.log
    CustomLog /var/log/apache2/mantisbt-access.log combined
    
    <Directory /var/www/html/mantisbt>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Enable the virtual host and Apache rewrite module:

sudo a2ensite mantisbt.conf
sudo a2enmod rewrite
sudo systemctl reload apache2

Database Server Setup

MantisBT supports multiple database backends, but MySQL/MariaDB provides excellent performance and reliability. Install MariaDB server:

sudo apt install mariadb-server mariadb-client -y

Start and enable MariaDB services:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure your MariaDB installation by running the security script:

sudo mysql_secure_installation

Follow the prompts to set a root password, remove anonymous users, disable remote root login, and remove the test database.

Creating Database and User

Access the MariaDB console to create a dedicated database and user for MantisBT:

sudo mysql -u root -p

Execute the following SQL commands:

CREATE DATABASE mantisbt_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'mantisbt_user'@'localhost' IDENTIFIED BY 'secure_password_here';
GRANT ALL PRIVILEGES ON mantisbt_db.* TO 'mantisbt_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace secure_password_here with a strong password for enhanced security. The utf8mb4 character set ensures proper Unicode support for international content.

PHP Installation and Configuration

Install PHP and required extensions for MantisBT functionality:

sudo apt install php php-mysql php-xml php-curl php-gd php-mbstring php-zip php-soap php-ldap php-imap -y

For Apache users, also install:

sudo apt install libapache2-mod-php -y

For Nginx users, install PHP-FPM:

sudo apt install php-fpm -y
sudo systemctl start php8.3-fpm
sudo systemctl enable php8.3-fpm

Optimizing PHP Configuration

Edit the PHP configuration file to optimize settings for MantisBT:

sudo nano /etc/php/8.3/apache2/php.ini

Modify these values for better performance:

memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_vars = 3000
date.timezone = "UTC"

Restart Apache or PHP-FPM to apply changes:

sudo systemctl restart apache2

Create a PHP info file to verify the installation:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

Navigate to http://localhost/info.php to confirm PHP is working correctly with all required extensions loaded.

Downloading and Installing MantisBT

Obtaining the Latest Release

Check the official MantisBT website for the latest stable version. As of this guide, version 2.27.1 represents the current stable release. Download MantisBT using wget:

cd /tmp
wget https://sourceforge.net/projects/mantisbt/files/mantis-stable/2.27.1/mantisbt-2.27.1.tar.gz

Extracting and Placing Files

Extract the downloaded archive:

tar -xzf mantisbt-2.27.1.tar.gz

Move the extracted files to your web server document root:

sudo mv mantisbt-2.27.1 /var/www/html/mantisbt

Setting Proper Permissions

Configure ownership and permissions for security:

sudo chown -R www-data:www-data /var/www/html/mantisbt
sudo chmod -R 755 /var/www/html/mantisbt

Ensure the config directory is writable during installation:

sudo chmod 777 /var/www/html/mantisbt/config

Web-Based Configuration and Setup

Accessing the Installation Wizard

Open your web browser and navigate to your MantisBT installation URL:

http://localhost/mantisbt

or

http://your-server-ip/mantisbt

The MantisBT installation wizard will appear, displaying pre-installation checks. Review the system requirements verification to ensure all dependencies are met.

Install Mantis Bug Tracker on Ubuntu 24.04 LTS

Database Configuration

In the installation wizard, configure database settings:

  • Database Type: Select “MySQL Improved (mysqli)”
  • Hostname: Enter “localhost”
  • Username: Enter “mantisbt_user” (or your chosen username)
  • Password: Enter the password you created earlier
  • Database Name: Enter “mantisbt_db”

Test the database connection by clicking the appropriate button in the installation interface.

Administrative Account Setup

Create the initial administrator account:

  • Username: administrator (default)
  • Password: Choose a strong password
  • Email: Enter a valid email address for notifications

The installation wizard will create the necessary database tables and configure the initial system settings.

Completing Installation

After successful database installation, MantisBT will display a completion message. The system will indicate “Good” status for all components, confirming proper installation.

Remove installation files for security:

sudo rm -rf /var/www/html/mantisbt/admin/install.php

Reset config directory permissions:

sudo chmod 755 /var/www/html/mantisbt/config

Security Configuration and Hardening

SSL/TLS Certificate Setup

Secure your MantisBT installation with SSL certificates. For Let’s Encrypt certificates, install Certbot:

sudo apt install certbot python3-certbot-apache -y

Obtain and install certificates:

sudo certbot --apache -d mantisbt.yourdomain.com

Certbot will automatically configure HTTPS redirects and certificate renewal.

Additional Security Measures

Change the default administrator password immediately after installation. Use a strong password combining uppercase and lowercase letters, numbers, and special characters.

Configure additional security settings in the MantisBT configuration file:

sudo nano /var/www/html/mantisbt/config/config_inc.php

Add security-related configurations:

$g_allow_signup = OFF;
$g_enable_captcha = ON;
$g_max_failed_login_count = 5;
$g_reauthentication = ON;

File Permission Hardening

Secure file permissions further by making configuration files read-only:

sudo chmod 644 /var/www/html/mantisbt/config/config_inc.php
sudo chown root:www-data /var/www/html/mantisbt/config/config_inc.php

Testing and Verification

Functional Testing

Access your MantisBT installation and log in using the administrator credentials. The dashboard should load without errors, displaying the main interface elements.

Create a test project to verify functionality:

  1. Navigate to “Manage” → “Manage Projects”
  2. Click “Create New Project”
  3. Fill in project details and save
  4. Create a test issue within the project
  5. Verify email notifications are working

Performance Verification

Monitor system resources during initial usage to ensure adequate performance. Use tools like htop or top to observe CPU and memory usage:

sudo apt install htop -y
htop

Check web server logs for any errors:

sudo tail -f /var/log/apache2/error.log

Troubleshooting Common Issues

Database Connection Problems

If MantisBT cannot connect to the database, verify:

  • Database service is running: sudo systemctl status mariadb
  • Database credentials are correct
  • User has proper privileges on the database
  • PHP mysqli extension is installed and enabled

PHP Extension Errors

Missing PHP extensions will prevent proper operation. Install any missing extensions:

sudo apt install php-[extension-name] -y
sudo systemctl restart apache2

Permission Issues

File permission problems often cause errors. Reset permissions if needed:

sudo chown -R www-data:www-data /var/www/html/mantisbt
sudo find /var/www/html/mantisbt -type d -exec chmod 755 {} \;
sudo find /var/www/html/mantisbt -type f -exec chmod 644 {} \;

Memory Limit Errors

If you encounter memory limit errors, increase PHP memory limits:

sudo nano /etc/php/8.3/apache2/php.ini

Increase the memory_limit value:

memory_limit = 512M

Restart Apache after making changes.

Maintenance and Best Practices

Regular Backups

Implement a backup strategy for both files and database:

# Database backup
mysqldump -u mantisbt_user -p mantisbt_db > mantisbt_backup.sql

# File backup
tar -czf mantisbt_files_backup.tar.gz /var/www/html/mantisbt

Keeping MantisBT Updated

Regularly check for MantisBT updates and security patches. Follow the official upgrade documentation when updating to newer versions.

Monitoring and Logging

Configure log rotation and monitoring to maintain system health:

sudo nano /etc/logrotate.d/mantisbt

Add log rotation configuration:

/var/log/apache2/mantisbt-*.log {
    weekly
    missingok
    rotate 52
    compress
    delaycompress
    notifempty
    create 644 www-data www-data
}

Congratulations! You have successfully installed Mantis. Thanks for using this tutorial for installing Mantis Bug Tracker on your Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Mantis website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button