How to Install Mantis Bug Tracker on CentOS 7
Mantis Bug Tracker (Mantis BT) is a free and open source bug tracking tool written in PHP. Mantis BT can help you manage your projects and track application bugs deployed on your Alibaba Cloud Elastic Compute Service (ECS) instance.
1. You must have an Alibaba Cloud Elastic Compute Service (ECS) instance activated and have verified your valid payment method. If you are a new user, you can get a free account in your Alibaba Cloud account. If you don’t know about how to set up your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1GB RAM and 1 Core processor.
2. A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
First login to your server and upgrade all the available packages using the following command.
sudo yum -y update
Next, install EPEL repository using the following command.
sudo yum -y install epel-release
Install LAMP Server
Once the system is updated, you can install the dependencies required. To install Mantis BT, you will need to install the Apache web server along with MySQL and PHP with a few extensions.
Run the following command to install the Apache web server.
sudo yum -y install httpd
Start Apache and enable it to start at boot time using the following commands.
sudo systemctl start httpd.service && systemctl enable httpd.service
You can check the status of Apache web server using the following command.
sudo systemctl status httpd
You should see the following output:
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2019-01-01 04:05:26 UTC; 2min 8s ago
Main PID: 387 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
├─387 /usr/sbin/httpd -DFOREGROUND
├─388 /usr/sbin/httpd -DFOREGROUND
├─389 /usr/sbin/httpd -DFOREGROUND
├─390 /usr/sbin/httpd -DFOREGROUND
├─391 /usr/sbin/httpd -DFOREGROUND
└─392 /usr/sbin/httpd -DFOREGROUNDJan 01 04:05:26 Tue 2019-01-01systemd: Starting The Apache HTTP Server...
Jan 01 04:05:26 Tue 2019-01-01systemd: Started The Apache HTTP Server.
Next, install MariaDB using the following command.
sudo yum -y install mariadb mariadb-server
Now you can start MariaDB server and enable it to start at boot time like we have done before for Apache web server, using the following commands.
sudo systemctl start mariadb && sudo systemctl enable mariadb
You can check the status of MariaDB using this below-given command and you should see the following output.
sudo systemctl status mariadb.service[root@Sajid ~]# systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2019-01-01 14:47:40 UTC; 22s ago
Main PID: 18035 (mysqld_safe)
├─18035 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─18192 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/ma...Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: The latest information about MariaDB is available at http://mariadb.org/.
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: You can find additional information about the MySQL part at:
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: http://dev.mysql.com
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: Support MariaDB development by buying support/new features from MariaDB
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: Corporation Ab. You can contact us about this at firstname.lastname@example.org.
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: Alternatively consider joining our community based development effort:
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/
Jan 01 14:47:39 ip-172-31-22-142 mysqld_safe: 170208 14:47:39 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Jan 01 14:47:39 ip-172-31-22-142 mysqld_safe: 170208 14:47:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jan 01 14:47:40 ip-172-31-22-142 systemd: Started MariaDB database server.
We recommend you to make sure that this installation is secure and to do so execute the following command.
You’ll be asked to provide a root password so enter an appropriate password and answer yes to all questions by pressing Y.
Now you’ll have to create a database for Mantis BT so please follow the instructions.
mysql -u root -p
You’ll be asked to enter password so simply enter a password and now execute the following queries to create a new database.
CREATE DATABASE mantis_data;
The above query will create a database named mantis_data. For the database, you can use any name you prefer in the place of mantis_data. Make sure that you use semicolon at the end of each query as a query always ends with a semicolon. Once the database is created you can create a new user and grant the required permissions to the user for the database.
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 query to do so.
GRANT ALL PRIVILEGES ON mantis_data.* TO 'mantis_user'@'localhost';
Now run the following query to immediately apply the changes to the database privileges.
Now you can exit from MariaDB prompt using the following command.
Next, let’s install PHP and Mantis supports PHP version greater than 5.5. So, here we will be installing PHP 7. Unfortunately, PHP 7 is not available in CentOS 7 repository by default, so we will install webtatic repository using the following command.
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Next, execute the following command to install PHP 7 with the required modules.
sudo yum -y install php71w php71w-cli php71w-mysqli
We have installed all the required dependencies to install mantis. Now we are ready to install Mantis bug tracker, so download the latest stable version of Mantis using the following command.
Next, unzip the downloaded package using the following command.
Next, move the extracted package files to apache web root directory using the following command.
sudo mv mantisbt-2.18.0 /var/www/html/mantis
Now you will need to change the ownership rules of the mantis directory using the following command.
chown -R apache:apache /var/www/html/mantis
Create a Virtual Host
You have installed all the required dependencies and mantis on your CentOS 7 server. Now you will need to create a virtual host file for mantis. Execute the following command to create a virtual host file.
sudo nano /etc/httpd/conf.d/mantis.conf
Add the following content to the file.
Options MultiViews FollowSymlinks
Allow from all
Save the file and exit from text editor. Please replace YourDomain with your actual domain name registered with Alibaba Cloud.
Finally, restart your apache web server using the following command.
sudo systemctl restart httpd
Next, you will need to modify the firewall rules. Simply, execute the following commands and they will do the job for you.
sudo firewall-cmd --zone=public --permanent --add-service=httpsudo firewall-cmd --reload
Mantis Web Interface
Everything is installed and configured now you can access Mantis through a web browser. Open up your favorite web browser and visit http://YourDomain.com and you will see a Mantis pre-installation check web page. You will be asked to provide all the necessary details such as Database Name, Username, Password, Admin username, and Password.
Then click on the Install/Upgrade Database button to proceed further. On the next interface, click on Continue button and then you will see the Mantis login web page.
administrator as username and
root as password and then click on Login button, you will see the mantis default admin dashboard and from there you can manage your all projects.
In this guide, you have learned to install LAMP server and Mantis Bug Tracker on your CentOS 7 server. Now you can deploy your projects and track issues of your applications easily with Mantis BT.