How to Install Bugzilla on CentOS 7

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.

Bugzilla is free and open source web-based bug tracking tool. It is developed and used by the Mozilla project. Bugzilla is widely used by various organizations to improve their software application because it allows you to track defects and code changes in your applications. You can communicate with your Dev team easily and submit and review patches using Bugzilla.

In this guide, we will show you how to install Bugzilla bug tracking system on your Alibaba Cloud Elastic Compute Service (ECS) CentOS 7 server.

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 tutorialor 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.
3. A sudo user

Update System

First login to your server and upgrade all the available packages using the following command.

sudo yum -y update

Next, install the EPEL repository using the following command.

sudo yum -y install epel-release

Install Perl

Bugzilla requires Perl 5.14 or greater so here we will be installing perl 5.16.x with some required Perl modules using the following command.

sudo yum -y install perl perl-CPAN perl-DBD-MySQL

Next, you’ll need to verify this installation using the following command and make sure it’s greater than 5.14.

perl -v

Now Perl is installed successfully but you will need to install some other required dependencies. Execute the following command and it’ll do the job for you.

sudo yum -y install gcc gd gd-devel rst2pdf graphviz patchutils

Install Apache and MariaDB

Before installing Bugzilla, you will need to install the Apache web server along with MariaDB to store the data.

Run the following command to install the Apache web server.

sudo yum -y install httpd httpd-develsudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf

Now you can start Apache and enable it to start at boot time, using the following commands.

sudo systemctl start httpd.servicesudo systemctl enable httpd.service

Next, we will need to install MariaDB for database purposes for Bugzilla. So, let’s install the latest stable release of MariaDB using the following commands. Execute the commands one by one.

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bashsudo yum install MariaDB-server MariaDB-devel -y

Now you’ll have to start the MariaDB service and enable it to start at the boot time like we have done before for apache server, to do so please run following commands.

sudo systemctl start mariadb.servicesudo systemctl enable mariadb.service

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

sudo /usr/bin/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.

1. Enter current password for root (enter for none):  ENTER
2. Set root password? [Y/n]: Y
3. New password: `YourMariaDB_rootPassword`
4. Re-enter new password: `YourMariaDB_rootPassword`
5. Remove anonymous users? [Y/n]: `Y`
6. Disallow root login remotely? [Y/n]: `Y`
7. Remove test database and access to it? [Y/n]: `Y`
8. Reload privilege tables now? [Y/n]: `Y`

Now you’ll have to create a database for Bugzilla so please follow the instructions.

mysql -u root -p

You’ll be asked to enter a password so simply enter a password and now execute the following queries to create a new database.

CREATE DATABASE bugzilla_data;

The above query will create a database named bugzilla_data. For the database, you can use any name you prefer in the place of bugzilla_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 'bugzilla_user'@'localhost' IDENTIFIED BY 'StrongPassword';

The above query will create a user with username bugzilla_user. You can use any preferred username instead of bugzilla_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 bugzilla_data.* TO 'bugzilla_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

Now let’s modify the configuration file of MariaDB using any text editor. Here we are using nano text editor because its interface is more user-friendly, you can also install it using sudo yum -y install nano.

Now execute the following command to edit the configuration file.

sudo nano /etc/my.cnf.d/server.cnf

Add the following content under the [mysqld] line:

#Bugzilla
#Allow packets up to 16M
max_allowed_packet=16M
#Allow small words in full-text indexes
ft_min_word_len=2

Finally, save the file and exit from the text editor and then restart the MariaDB server using the following command.

sudo systemctl restart mariadb.service

Install Bugzilla

Once you have all the required dependencies installed, you can proceed to download and install Bugzilla on your CentOS 7 server. You can download the latest stable release of Bugzilla using the following wget command.

cdwget https://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-5.0.4.tar.gz

Next, unzip the archive file using the following command.

sudo tar -C /opt -zxvf bugzilla-5.0.4.tar.gz

Next, create a version-independent soft link to facilitate future updates.

sudo ln -s /opt/bugzilla-5.0.4 /var/www/html/bugzilla

Now execute the following command to check for missing Perl modules for Bugzilla.

sudo /var/www/html/bugzilla/checksetup.pl

By running above command you will learn about the availability of any required or optional Perl modules on your machine. So, you will need to install all the required and optional Perl modules using this single command given below.

sudo /usr/bin/perl /var/www/html/bugzilla/install-module.pl --all

Now, you will need to edit the localconfig to add the database details. Execute the following command to open localconfig file using any text editor.

sudo nano /var/www/html/bugzilla/localconfig

Find the following lines in the file and edit the values according to your database details like this:

$webservergroup = 'apache';
$db_driver = 'mysql';
$db_host = 'localhost';
$db_name = 'bugzilla_data';
$db_user = 'bugzilla_user';
$db_pass = 'StrongPassword';

Save the file and exit from the text editor.

Now run the checksetup.pl Perl script again to initialize Bugzilla using the following command.

sudo /var/www/html/bugzilla/checksetup.pl

You will be asked to enter your administrator details such as admin’s email address, admin name, and administrator password.

Next, you will need to change the ownership rules of Bugzilla files to allow Apache to access these files.

sudo chown -R apache:apache /opt/bugzilla-5.0.4

Create a Virtual Host

You have successfully installed Bugzilla on your CentOS 7 server but Apache web server not is not aware of this yet, so you will need to create a virtual host. Run the following command to do so.

sudo nano /etc/httpd/conf.d/bugzilla.conf

Add the following content to the file.

<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/bugzilla/
ServerName bugzilla.example.com
ServerAlias www.bugzilla.example.com
<Directory /var/www/html/bugzilla/>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit FileInfo Indexes Options AuthConfig
</Directory>
ErrorLog /var/log/httpd/bugzilla.example.com-error_log
CustomLog /var/log/httpd/bugzilla.example.com-access_log common
</VirtualHost>

Please replace value of ServerAdmin, ServerName, and, ServerAlias with your actual one. Save the file and exit, and then restart the Apache web server to apply changes using the following command.

sudo systemctl restart httpd.service

Finally, you will need to modify the firewall rules. So, simply execute the following commands and they will do the job for you.

sudo firewall-cmd --zone=public --add-port=80/tcp --permanentsudo firewall-cmd --reload

Testing

You have successfully installed Bugzilla on your server, you can test this installation using the Perl script like this:

sudo /var/www/html/bugzilla/testserver.pl http://YourServerIP

Replace YourServerIP with your actual server IP address and if nothing goes wrong then you should see something similar to this:

TEST-OK Webserver is running under group id in $webservergroup.
TEST-OK Got padlock picture.
TEST-OK Webserver is executing CGIs via mod_cgi.
TEST-OK Webserver is preventing fetch of http://YourServerIP/localconfig.
TEST-OK GD version 2.68, libgd version 2.0.34; Major versions match.
TEST-OK GD library generated a good PNG image.
TEST-OK Chart library generated a good PNG image.
TEST-OK Template::Plugin::GD is installed.

Now open up your favorite web browser and visit http://YourServerIP to access the Bugzilla site. When you see Bugzilla web interface click on Log In button and then provide your administration credentials to login so that you can set up Bugzilla as you want.

Conclusion

In this guide, you learned to install Bugzilla bug tracking system on your CentOS 7 server. Now you can deploy your projects and track issues of your applications. We hope now you have enough knowledge to work with Bugzilla.

Reference:https://www.alibabacloud.com/blog/how-to-install-bugzilla-on-centos-7_594622?spm=a2c41.12714840.0.0

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store