×
Community Blog How to Install Mantis Bug Tracker on CentOS 7

How to Install Mantis Bug Tracker on CentOS 7

In this guide, you will learn how to install Mantis BT to track application bugs on your Alibaba Cloud Elastic Compute Service (ECS) CentOS 7 server.

By Sajid Qureshi, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

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.

Prerequisites

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.

Update System

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
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 387 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─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[1]: Starting The Apache HTTP Server...
Jan 01 04:05:26 Tue 2019-01-01systemd[1]: 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)
   CGroup: /system.slice/mariadb.service
           ├─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[17956]: 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[17956]: You can find additional information about the MySQL part at:
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: http://dev.mysql.com
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: Support MariaDB development by buying support/new features from MariaDB
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: Corporation Ab. You can contact us about this at sales@mariadb.com.
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: Alternatively consider joining our community based development effort:
Jan 01 14:47:38 ip-172-31-22-142 mariadb-prepare-db-dir[17956]: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/
Jan 01 14:47:39 ip-172-31-22-142 mysqld_safe[18035]: 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[18035]: 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[1]: Started MariaDB database server.

We recommend you to make sure that this installation is secure and to do so execute the following command.

sudo mysql_secure_installation

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.

FLUSH PRIVILEGES;

Now you can exit from MariaDB prompt using the following command.

exit

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

Install Mantis

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.

wget https://sourceforge.net/projects/mantisbt/files/mantis-stable/2.18.0/mantisbt-2.18.0.zip

Next, unzip the downloaded package using the following command.

unzip mantisbt-2.18.0.zip

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.

<VirtualHost *:80>
ServerAdmin admin@YourDomain.com
DocumentRoot "/var/www/html/mantis"
ServerName YourDomain.com
<Directory />
Options FollowSymLinks
AllowOverride All
<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 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=http
sudo 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.

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

Conclusion

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.

1 0 0
Share on

Alibaba Clouder

2,599 posts | 764 followers

You may also like

Comments

ideal March 29, 2019 at 4:12 am

good article~