How to install Mantis Bug Tracker on CentOS 8

How to install Mantis Bug Tracker on CentOS 8

MantisBT is a free, open source and web-based error tracking software written in PHP. It is simple, easy to use, user-friendly, and comes with many tools to help you work with your team to quickly resolve errors and problems. It provides a rich set of features, including notification via email, role-based access control, project, sub-project and category support, problem diagrams, customizable dashboards, and more.

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

prerequisites

  • Server running CentOS 8.
  • A valid domain name pointing to the server IP.
  • The root password is configured on the server.

Install LAMP server

First, you need to install the Apache web server, MariaDB server, PHP and other required software packages into the system. You can install all components using 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 services and use the following commands to enable them to start when the system restarts:

systemctl start httpdsystemctl start mariadbsystemctl enable httpdsystemctl enable mariadb

Once completed, you can proceed to the next step.

Create a database for the praying mantis

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

First, log in to MariaDB shell using the following command:

mysql

After logging in, use the following commands to create the database and user:

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

Next, use the following command to clear the privileges and exit from the MariaDB shell:

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

Once completed, you can proceed to the next step.

Install praying mantis

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

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

After the download is complete, use the following command to decompress the downloaded file:

unzip mantisbt-2.24.2.zip

Next, copy the extracted directory to the Apache root directory using 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 completed, 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 line:

<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 done, then restart the Apache service to apply the changes:

systemctl restart httpd

You can also use the following command to verify the status of Apache:

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...

Let’s encrypt SSL to protect Mantis

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

You can install the Certbot client using the following command:

wget https://dl.eff.org/certbot-automv certbot-auto /usr/local/bin/certbot-autochown root /usr/local/bin/certbot-autochmod 0755 /usr/local/bin/certbot-auto

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

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

The above command will first install all the necessary dependencies on the server. After installation, you will be asked to provide an email address and accept the terms 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 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 press Enter to continue. After the installation is complete, 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. Therefore, you need to configure the Mantis website.

You can configure SELinux with the following command:

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

Next, use the following command to allow ports 80 and 443 through the firewall:

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

Once completed, you can proceed to the next step.

Visit Mantis Web UI

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

Configuration database

Provide your database name, user name, administrator user name, password, email, and click Installation/upgrade Database button. After the installation is complete, you will see the following screen:

Mantis installation is completeadvertising

Next, click “carry onButton, you will see the Mantis BT login page on the following screen:

Log in to Praying Mantis

Provide the default Mantis username as Administrator, and click log in Button. You will be asked for the password, as shown in the following screen:

Enter the administrator password

Provide Mantis’s default password “root” and click the “Login” button. You will be redirected to the following screen:

Mantis Dashboard

Modify the 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 Update user Button. You should see the Mantis dashboard in the following screen:

Mantis Bugtracker Dashboard

in conclusion

Congratulations! You have successfully installed Mantis on CentOS 8 using “Let’s Encrypt SSL”. You can now implement Mantis in the development environment and work with the team. If you have any questions, please feel free to ask me.

Sidebar