How to Install Mantis Bug Tracker on CentOS 8

MantisBT is a free, open-source and web-based bug tracking software written in PHP. It is simple, easy to use, user-friendly, and comes with a lot of tools that help you collaborate with teams to resolve bugs and issues quickly. It offers a rich set of features including, Notification via email, Role-based access control, Projects, sub-projects, and category support, Issue relationship graph, customizable dashboard and many more.

In this tutorial, we will show you how to install Mantis Bug Tracking system on CentOS 8.

Prerequisites

  • A server running CentOS 8.
  • A valid domain name pointed with your server IP.
  • A root password is configured on the server.

Install LAMP Server

First, you will need to install the Apache web server, MariaDB server, PHP and other required packages to your system. You can install all of them with the following command:

dnf install httpd mariadb-server php php-mysqli php-mbstring php-curl unzip -y

Once all the packages are installed, start the Apache and MariaDB service and enable them to start at system reboot with the following command:

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

Once you are finished, you can proceed to the next step.

Create a Database for Mantis

Mantis uses MariaDB or MySQL as a database backend. So you will need to create a database and user for Mantis.

First, log into MariaDB shell with the following command:

mysql

Once login, create a database and user with the following command:

MariaDB [(none)]> CREATE DATABASE mantisdb;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON mantisdb.* TO 'mantis'@'localhost' IDENTIFIED BY 'mantispassword';

Next, flush the privileges and exit from the MariaDB shell with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Once you are finished, you can proceed to the next step.

Install Mantis

First, download the latest version of the Mantis from the Sourceforge website with the following command:

wget https://excellmedia.dl.sourceforge.net/project/mantisbt/mantis-stable/2.24.2/mantisbt-2.24.2.zip

Once the download is completed, unzip the downloaded file with the following command:

unzip mantisbt-2.24.2.zip

Next, copy the extracted directory to the Apache root directory with the following command:

cp -r mantisbt-2.24.2 /var/www/html/mantis

Next, change the ownership of the mantis directory to apache:

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

Once you are finished, you can proceed to the next step.

Configure Apache for Mantis

Next, you will need to create an Apache virtual host configuration file for Mantis. You can create it with the following command:

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

Add the following lines:

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/html/mantis"
ServerName mantis.linuxbuz.com
<Directory "/var/www/html/mantis/">
Options MultiViews FollowSymlinks
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 service to apply the changes:

systemctl restart httpd

You can also verify the status fo the Apache with the following command:

systemctl status httpd

You should get the following output:

? httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           ??php-fpm.conf
   Active: active (running) since Sat 2020-09-19 11:06:51 EDT; 37s ago
     Docs: man:httpd.service(8)
 Main PID: 41737 (httpd)
   Status: "Running, listening on: port 80"
    Tasks: 213 (limit: 25014)
   Memory: 25.0M
   CGroup: /system.slice/httpd.service
           ??41737 /usr/sbin/httpd -DFOREGROUND
           ??41738 /usr/sbin/httpd -DFOREGROUND
           ??41739 /usr/sbin/httpd -DFOREGROUND
           ??41740 /usr/sbin/httpd -DFOREGROUND
           ??41741 /usr/sbin/httpd -DFOREGROUND

Sep 19 11:06:51 centos8 systemd[1]: Starting The Apache HTTP Server...

Secure Mantis with Let's Encrypt SSL

Next, you will need to install the Certbot utility in your system to download and install Let's Encrypt SSL for your Mantis website.

You can install the Certbot client with the following command:

wget https://dl.eff.org/certbot-auto
mv certbot-auto /usr/local/bin/certbot-auto
chown root /usr/local/bin/certbot-auto
chmod 0755 /usr/local/bin/certbot-auto

Next, obtain and install an SSL certificate for your Mantis website with the following command:

certbot-auto --apache -d mantis.linuxbuz.com

The above command will first install all the required dependencies on your server. Once installed, you will be asked to provide an email address and accept the term of service as shown below:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y 


Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mantis.linuxbuz.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/apache/conf.d/mantis.conf

Next, you will need to choose whether or not to redirect HTTP traffic to HTTPS as shown below:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Type 2 and hit Enter to continue. Once the installation has been finished, you should see the following output:

Redirecting all traffic on port 80 to ssl in /etc/apache/conf.d/mantis.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://mantis.linuxbuz.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=mantis.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/mantis.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/mantis.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-03-23. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again with the "certonly" option. To non-interactively renew *all*
   of your certificates, run "certbot-auto renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Configure SELinux and Firewall

By default, SELinux is enabled in CentOS 8. So you will need to configure it for your Mantis website.

You can configure the SELinux with the following command:

setsebool httpd_can_network_connect on -P
chcon -R -u system_u -t httpd_sys_rw_content_t -r object_r /var/www/html/mantis

Next, allow port 80 and 443 through the firewall with the following command:

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

Once you are done, you can proceed to the next step.

Access Mantis Web UI

Now, open your web browser and access the Mantis web interface using the URL https://mantis.linuxbuz.com. You should see the following screen:

Mantis pre-installation check

Configure the database

Provide your database name, username, admin username, password, email and click on the Install/Upgrade Database button. Once the installation is completed, you should see the following screen:

Mantis installation complete

Next, click on the "Continue" button, you should see the Mantis BT login page in the following screen:

Login to Mantis

Provide a default Mantis username administrator and click on the Login button. You will be asked to provide the password as shown in the following screen:

Enter admin password

Provide Mantis default password "root" and click on the Login button. You will be redirected to the following screen:

Mantis Dashboard

Change administrator password

It is recommended to change your default administrator password. Provide your current password, new password, email, real name, access level, project access level and click on the Update User button. You should see the Mantis dashboard in the following screen:

Mantis Bugtracker Dashboard

Conclusion

Congratulations! you have successfully installed Mantis with Let's Encrypt SSL on CentOS 8. You can now implement Mantis in your development environment and collaborate with teams. Feel free to ask me if you have any questions.

Share this page:

0 Comment(s)