How to Install Mantis Bug Tracker on CentOS 7

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month. Get a Cloud Server

Mantis is a free and popular open source bug tracking system. It is written in PHP and supports all types of database server. It provides a professional dashboard to manage bugs assigned to the user. It supports powerful access control which provides per project base user access. It is very flexible, you can customize the issue fields, notifications, and workflow.

In this tutorial, we will learn to install Mantis on CentOS 7 with PHP 7.1 and MySQL/MariaDB.

Requirements

Mantis does not require any special hardware requirements. It can be installed on servers with a small amount of RAM. All the required dependencies will be installed throughout the tutorial. You will need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i to switch to root user.

Installing Mantis

Before installing any package it is recommended that you update the packages and repository using the following command.

yum -y update

Once you have your system updated, you can proceed to install the LAMP stack. Start the LAMP installation by installing Apache web server and MariaDB, which is a fork of MySQL using the following command.

yum -y install httpd mariadb-server mariadb

The above command will install Apache web server with MariaDB database server. Now you will need to install PHP. Mantis supports PHP greater than 5.5. In this tutorial, we will install the latest version of PHP for faster processing and improved security. The YUM repository contains PHP version 5.4 only, hence we will need to use the Webtatic repository to install a version of PHP 7.1. Run the following commands for installing EPEL repository as EPEL repository is required before we install Webtatic repository.

yum -y install epel-release

yum -y update

Now install Webtatic repository using the following commands.

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

To install PHP 7.1 and all the required PHP modules, run the following command.

yum -y install php71w php71w-cli php71w-mysqli

To verify that PHP is installed correctly, run the following command.

php -v

You will likely see the following output.

[root@liptan-pc ~]# php -v PHP 7.1.1 (cli) (built: Jan 19 2017 20:35:16) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

Now start Apache web server and enable it to start at boot time using the following command.

systemctl start httpd

systemctl enable httpd

To start MariaDB and enable it to start at boot time using the following commands.

systemctl start mariadb

systemctl enable mariadb

Now run the following commands to secure your MySQL or MariaDB installation.

mysql_secure_installation

It will run a small script which asks you to provide the root password for MariaDB. As we have just installed MariaDB, the root password is not set, just press enter to proceed further. It will ask you if you want to set a root password for your MariaDB installation, choose y and set a strong password for the installation. It will further ask you for removing test databases and anonymous users. Most of the questions are self-explanatory and you should answer yes or y to all the questions.

To create a database we will need to login to MySQL command line first. Run the following command for same.

mysql -u root -p

This will prompt you for the password, provide the root password of MySQL which you have set earlier. Now run the following query to create a new database for your Mantis installation.

CREATE DATABASE mantis;

The above query will create a database named mantis . For the database, you can use any name you prefer at the place of mantis . Make sure that you use semicolon at the end of each query as the query always ends with a semicolon. Once the database is created you can create a new user and grant all the permissions to the user for the database. To create a new database user, run the following query.

CREATE USER 'mantis_user'@'localhost' IDENTIFIED BY 'StrongPassword';

The above query will create a user with username mantis_user . You can use any preferred username instead of mantis_user . Replace StrongPassword with a strong password. Now provide the appropriate privileges to your database user over the database you have created. Run the following command.

GRANT ALL PRIVILEGES ON mantis.* TO 'mantis_user'@'localhost';

Now run the following command to immediately apply the changes on the database privileges.

FLUSH PRIVILEGES;

Exit from MySQL prompt using exit command.

As we have all the dependencies ready, we can now download the install package from the Mantis site.

cd /var/www

wget https://downloads.sourceforge.net/project/mantisbt/mantis-stable/2.1.0/mantisbt-2.1.0.zip -O mantis.zip

The above command will download the installer archive and store it as mantis.zip file. You can always look for the latest release by going to the Mantis download page.

Now unzip the file into /var/www/mantis directory using the following command.

unzip mantis.zip

If you do not have unzip installed, you can run yum -y install unzip . The above command will extract the archive in mantisbt-2.1.0 directory. Rename the directory using the following command.

mv mantisbt-* mantis

Now create a virtual host for your domain or subdomain which will be used to access the mantis site. Run the following command for same.

nano /etc/httpd/conf.d/yourdomain.com.conf

<VirtualHost *:80> ServerAdmin me@liptanbiswas.com ServerName yourdomain.com DocumentRoot /var/www/mantis <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/mantis> Options FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from All </Directory> TransferLog /var/log/httpd/yourdomain.com_access.log ErrorLog /var/log/httpd/yourdomain.com_error.log </VirtualHost>

Copy and paste the following lines into the file.

In the above configuration file, replace yourdomain.com with your domain or subdomain.

Provide the ownership of the files to the Apache web server using the following command.

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

Now restart the Apache web server using the following command.

systemctl restart httpd

Now access the following URL through your web browser.

http://yourdomain.com

You will see the following screen.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1465083497.png" alt="" />

The installer will show you about the requirements needed to install Mantis. If you have followed this tutorial correctly, you will see that you have installed and configured all the required dependencies.

Below the installation check, you will see the interface to provide database details. Choose the type of database as MySQL improved. Provide the database username, password and the name of the database. Leave Admin Username and Admin Password blank. Choose the default timezone and leave everything as it is. Finally, click Install/Upgrade Database. If the database credentials are correct, the installer will write the data into the database.

The installation of the application is now finished. You can login to the dashboard by going to the site. The initial administrator username is administrator and password is root.

Once you are logged in, you will be asked to change your password. It is very important that you change the password immediately.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/1029962610.png" alt="" />

You can now browse the dashboard by clicking My View button from the left sidebar.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/126608115.png" alt="" />

Conclusion

In this tutorial, we have learned how to install Mantis Bug Tracker on CentOS 7. You can now easily install Mantis to track the bugs in the software you are developing.