Home / How To / How to install Mantis Bug Tracker on CentOS 8

How to install Mantis Bug Tracker on CentOS 8



MantisBT is a free software with open source and web-based bug tracking written in PHP. It is simple, easy to use, user friendly and comes with many tools to help you work with teams to quickly fix bugs and issues. It offers a rich set of features including, Email Notification, Role-Based Access Control, Projects, Subprojects and Category Support, Problem Relationship Charts, Customizable Dashboard and many more.

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

Conditions

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

Install LAMP Server

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

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

Once all the packages have been installed, start Apache and the MariaDB service and enable them to restart at system startup with the following command:

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

When you are done, you can move on to the next step.

Create a database for mantis

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

First log in to the MariaDB shell with the following command:

mysql

Once logged in, 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';

Then flush the permissions and exit the MariaDB shell with the following command:

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

When you are done, you can move on to the next step.

Install Mantis

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

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

When the download is complete, unzip the downloaded file with the following command:

unzip mantisbt-2.24.2.zip

Then copy the extracted directory to the Apache root directory using the following command:

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

Then change the ownership of the mantis directory to apache:

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

When you are done, you can move on to the next step.

Configure Apache for mantis

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

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

Add the following lines:


ServerAdmin [email protected]
DocumentRoot "/var/www/html/mantis"
ServerName mantis.linuxbuz.com

Options MultiViews FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all


TransferLog /var/log/httpd/mantis_access.log
ErrorLog /var/log/httpd/mantis_error.log


Save and close the file when you are done, and then restart the Apache service to apply the changes:

systemctl restart httpd

You can also verify the status of 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 need to install the Certbot tool 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

Then download and install an SSL certificate for your Mantis website using the following command:

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

The above command first installs all necessary dependencies on your server. Once installed, you will be asked to enter an email address and accept the service time as 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

Then you need to choose whether to redirect HTTP traffic to HTTPS as below:Advertisement

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. When 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. So you need to configure it for your Mantis website.

You can configure 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

Then pass ports 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

When you are done, you can move on to the next step.

Go to the Mantis Web UI

Now open your browser and go to Manti’s web interface with URL https://mantis.linuxbuz.com. You should see the following screen:

Checking the mantis before installation

Configure the database

Enter your database name, username, admin username, password, email and click Install / upgrade Database button. When the installation is complete, you should see the following screen:

Mantis installation readyAdvertisement

Advertisement

Then click on “Continue“button, you should see the Mantis BT login page on the following screen:

Log in to Mantis

Enter a default Mantis username administrator and click Sign in button. You will be asked to enter the password displayed on the following screen:

Enter Administrator Password

Enter Manti’s default password “root” and click the login button. You will be redirected to the following screen:

Mantis Dashboard

Change administrator password

We recommend that you change your default administrator password. Enter your current password, new password, email, real name, access level, project access level and click Update users button. You should see the Mantis Dashboard on 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.


Source link