How to install Mantis Bug Tracker on Linux
Mantis Bug Tracker is a widely used open-source, web-based bug tracking system. Written in PHP and utilizing a MySQL/MariaDB database for data storage, it’s an excellent tool for developers and project managers to efficiently manage issues, bugs, and tasks throughout software development lifecycles. This article provides a comprehensive guide on how to install Mantis Bug Tracker on a Linux system.
Prerequisites
Before diving into the installation, ensure your system meets the following requirements:
- A running Linux system (e.g., Ubuntu, Debian, CentOS, RHEL).
- Root or sudo privileges.
- Apache HTTP Server installed (or another web server of your choice).
- MariaDB or MySQL database server installed.
- PHP 7.2 or higher installed, along with necessary PHP extensions.
Once these prerequisites are confirmed, you can proceed with the installation of Mantis Bug Tracker.
Step 1: Install Apache HTTP Server
If Apache isn’t already installed, use your distribution’s package manager to install it. For Ubuntu/Debian:
$ sudo apt-get install apache2
For CentOS/RHEL:
$ sudo yum install httpd
After installation, start the Apache service and enable it to launch automatically at boot:
$ sudo systemctl start apache2 # On Ubuntu/Debian and CentOS/RHEL
$ sudo systemctl enable apache2 # On Ubuntu/Debian and CentOS/RHEL
Step 2: Install MariaDB
Next, install the MariaDB database server. On Ubuntu/Debian:
$ sudo apt-get install mariadb-server
On CentOS/RHEL:
$ sudo yum install mariadb-server
Secure the MariaDB installation by running:
$ sudo mysql_secure_installation
Follow the on-screen prompts to set a root password and configure security options.
Step 3: Install PHP and Required Extensions
Mantis Bug Tracker needs PHP and specific PHP extensions. On Ubuntu/Debian:
$ sudo apt-get install php php-gd php-mbstring php-curl
On CentOS/RHEL:
$ sudo yum install php php-gd php-mbstring php-curl
Restart Apache after installing PHP and extensions:
$ sudo systemctl restart apache2 # On Ubuntu/Debian
$ sudo systemctl restart httpd # On CentOS/RHEL
Step 4: Download Mantis Bug Tracker
Download the latest stable version of Mantis Bug Tracker from the official website. As of this writing, the latest stable version is 2.26.2.
Download using wget
:
$ wget https://sourceforge.net/projects/mantisbt/files/mantis-stable/2.26.2/mantisbt-2.26.2.tar.gz
Extract the downloaded package:
$ tar -xvzf mantisbt-2.26.2.tar.gz
This creates a directory named mantisbt-2.26.2
.
Step 5: Configure Apache for Mantis Bug Tracker
Configure Apache to serve the Mantis Bug Tracker application. Create a new virtual host configuration file:
$ sudo nano /etc/apache2/sites-available/mantis.conf
Add the following configuration:
<VirtualHost *:80>
ServerName mantis.example.com
DocumentRoot /path/to/mantis
<Directory /path/to/mantis>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/mantis_error.log
CustomLog ${APACHE_LOG_DIR}/mantis_access.log combined
</VirtualHost>
Replace mantis.example.com
with your desired domain or IP address and /path/to/mantis
with the actual path to the extracted Mantis Bug Tracker directory.
Enable the site and disable the default site:
$ sudo a2ensite mantis.conf
$ sudo a2dissite 000-default.conf
Restart Apache:
$ sudo systemctl restart apache2
Step 6: Create a Database for Mantis Bug Tracker
Create a MySQL/MariaDB database and user for Mantis Bug Tracker. Log in to the MySQL server:
$ sudo mysql -u root -p
Enter the root password.
Create the database and user:
CREATE DATABASE mantisdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'mantisuser'@'localhost' IDENTIFIED BY 'YourStrongPassword';
GRANT ALL PRIVILEGES ON mantisdb.* TO 'mantisuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace YourStrongPassword
with a strong, secure password.
Step 7: Configure Mantis Bug Tracker
Configure the Mantis Bug Tracker application. Navigate to the Mantis Bug Tracker directory:
$ cd /path/to/mantis
Copy the sample configuration file:
$ cp config_defaults_inc.php.sample config_inc.php
Edit the configuration file:
$ nano config_inc.php
Update the database settings:
$g_database_type = 'mysqli';
$g_hostname = 'localhost';
$g_db_username = 'mantisuser';
$g_db_password = 'YourStrongPassword';
$g_database_name = 'mantisdb';
Replace YourStrongPassword
with the password you chose for the mantisuser
.
Step 8: Install Mantis Bug Tracker via Web Interface
Access the Mantis Bug Tracker installation script through your web browser:
http://mantis.example.com/admin/install.php
Follow the on-screen instructions to complete the installation.
Step 9: Configure Mantis Bug Tracker (Optional)
After installation, configure Mantis Bug Tracker to meet your specific requirements. Common configuration options include:
- User management: Create and manage user accounts and assign roles.
- Project configuration: Define projects and categories for bug tracking.
- Workflow configuration: Customize the bug reporting and resolution workflow.
- Email configuration: Configure email notifications for bug updates.
Refer to the official documentation for more advanced configuration options.
Step 10: Secure Mantis Bug Tracker
Secure your Mantis Bug Tracker installation:
- Keep Mantis Bug Tracker up to date with the latest security patches.
- Use strong passwords for all user accounts.
- Restrict access to the Mantis Bug Tracker directory.
- Configure HTTPS to encrypt traffic between the client and server.
- Regularly back up the Mantis Bug Tracker database.
These security measures will help protect your bug tracking data.
Conclusion
Following these steps will result in a functional installation of Mantis Bug Tracker on your Linux system. Regular updates and proper configuration will ensure security and stability. The Mantis Bug Tracker documentation and community forums offer assistance if you encounter any problems.
Alternative Installation Methods
While the above steps outline a manual installation process, there are alternative methods that can simplify the deployment of Mantis Bug Tracker. Here are two different approaches:
1. Using Docker
Docker provides a containerization platform that allows you to run applications in isolated environments. This method simplifies the installation process and ensures consistency across different systems.
Explanation:
Docker images encapsulate the application and all its dependencies, making deployment straightforward. You can use pre-built Docker images for Mantis Bug Tracker, eliminating the need to manually install Apache, PHP, and MariaDB.
Steps:
-
Install Docker: If you don’t have Docker installed, follow the instructions for your distribution. For example, on Ubuntu:
$ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io
-
Install Docker Compose (Optional): Docker Compose simplifies the management of multi-container Docker applications. Install it using:
$ sudo apt-get install docker-compose-plugin
-
Create a
docker-compose.yml
file: This file defines the services needed for Mantis Bug Tracker, including the database and the Mantis Bug Tracker application itself.version: "3.8" services: db: image: mariadb:10.6 restart: always environment: MYSQL_ROOT_PASSWORD: root_password MYSQL_DATABASE: mantisdb MYSQL_USER: mantisuser MYSQL_PASSWORD: mantis_password volumes: - db_data:/var/lib/mysql mantis: image: vimagick/mantisbt restart: always ports: - "8080:80" environment: MANTIS_DB_HOST: db MANTIS_DB_NAME: mantisdb MANTIS_DB_USER: mantisuser MANTIS_DB_PASSWORD: mantis_password depends_on: - db volumes: db_data:
Replace
root_password
,mantis_password
with your desired passwords. -
Run Docker Compose: Navigate to the directory containing the
docker-compose.yml
file and run:$ docker-compose up -d
This command downloads the necessary images and starts the containers in detached mode.
-
Access Mantis Bug Tracker: Open your web browser and navigate to
http://localhost:8080
.
This method simplifies the installation and ensures a consistent environment.
2. Using a Pre-built Virtual Machine Image
Another alternative is to use a pre-built virtual machine (VM) image that includes Mantis Bug Tracker and all its dependencies.
Explanation:
VM images provide a complete operating system environment with Mantis Bug Tracker pre-installed and configured. This eliminates the need for manual installation steps.
Steps:
-
Choose a VM image: Search for pre-built Mantis Bug Tracker VM images. Bitnami often provides such images.
-
Download and import the VM image: Download the VM image in a format compatible with your virtualization software (e.g., VirtualBox, VMware). Import the image into your virtualization software.
-
Configure the VM: Configure the VM settings, such as network settings and memory allocation.
-
Start the VM: Start the VM and follow the instructions provided by the VM image provider to access Mantis Bug Tracker.
This approach provides a quick and easy way to get Mantis Bug Tracker up and running without manual configuration. Remember to change default passwords for security.
These alternative methods offer simplified installation options compared to the manual approach, making it easier to deploy Mantis Bug Tracker in various environments.