How to Install Bugzilla 5.0.x on CentOS 7

Published on: Fri, Jun 8, 2018 at 1:15 pm EST
CentOS Linux Guides Programming Server Apps

Bugzilla is a free and open source bug tracking system that is being widely used by various vendors in order to continuously improve their software applications.

In this article, I will guide you through installing Bugzilla 5.0.4 on a Vultr CentOS 7 server instance.

Prerequisites

Bugzilla 5.0.4 requires Perl 5.14 or newer, a web server and a database server. We will install Perl 5.16.x, Apache 2.4.x and MariaDB 10.2.x, accordingly. More details about them are explained in the following sections.

Step 1: Install Perl 5.16.x and other dependencies

After logging in as a sudo user, you can easily install the Perl binary and required Perl modules using a built-in YUM repo:

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

Having Perl installed, use the following command to make sure that its version is newer than 5.14:

perl -v

For now, you should find v5.16.3, a qualified release for running Bugzilla 5.0.4, from the output.

Having Perl installed, you still need to install several dependencies:

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

Step 2: Install and configure Apache 2.4.x

Install and configure Apache 2.4.6 as follows:

sudo yum install httpd httpd-devel -y
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf
sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Step 3: Install and configure MariaDB 10.2.x

Install the latest stable release of MariaDB:

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
sudo yum install MariaDB-server MariaDB-devel -y
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Secure MariaDB:

sudo /usr/bin/mysql_secure_installation

When prompted, reply to questions as below:

  • Enter current password for root (enter for none): ENTER
  • Set root password? [Y/n]: Y
  • New password: your-MariaDB-root-password
  • Re-enter new password: your-MariaDB-root-password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

Log into the MySQL shell as root:

mysql -u root -p

Use the following MySQL queries to create a dedicated MariaDB database and a dedicated MariaDB user for Bugzilla:

Note: For security purposes, be sure to replace the below bugzilla, bugzillauser, and yourpassword with your own ones.

CREATE DATABASE bugzilla;
CREATE USER 'bugzillauser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON bugzilla.* TO 'bugzillauser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Modify MariaDB's config for Bugzilla:

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

Insert the following lines 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

Save and quit:

:wq!

Restart MariaDB in order to load the new settings:

sudo systemctl restart mariadb.service

Step 4: Install Bugzilla 5.0.4

Obtain the Bugzilla 5.0.4 archive from its official website:

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

Unzip the archive to your preferred location:

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

In order to facilitate future updates, you can create a version-independent soft link pointing to the directory in which current release of Bugzilla resides:

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

Use a Perl script within the Bugzilla directory to check for missing Perl modules:

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

By running this Perl script, you will learn about the availability of any required or optional Perl modules on your machine.

You can either individually install Perl modules in this fashion:

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

Or, try to install all of the required and optional Perl modules using a single command:

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

The compilation of Perl modules may take a while.

After the compilations have finished, re-run the checksetup.pl script to confirm the result, making sure that all required Perl modules and the DBD mysql Perl module are installed. The missing optional Perl modules can be dealt with later.

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

Next, add MySQL database info to the localconfig file:

sudo vi /var/www/html/bugzilla/localconfig

Find and edit the following lines, making sure that all parameters are using proper values as below:

$webservergroup = 'apache';
$db_driver = 'mysql';
$db_host = 'localhost';
$db_name = 'bugzilla';
$db_user = 'bugzillauser';
$db_pass = 'yourpassword';

Save and quit:

:wq!

For the third time, run the checksetup.pl script to initialize Bugzilla:

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

During the process, you will be asked to provide the administrator's credentials:

  • Administrator's e-mail address: admin@example.com
  • Administrator's real name: John Doe
  • Administrator's password: your-admin-password

In order to allow Apache to access Bugzilla files, you need to modify the ownership of all the Bugzilla files:

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

Since Apache is not aware of Bugzilla yet, you need to create an Apache virtual host for Bugzilla as follows:

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

Populate 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>

Save and quit:

:wq!

Restart Apache in order to load the new settings:

sudo systemctl restart httpd.service

Step 5: Modify firewall rules

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

Step 6: Test and access the installation of Bugzilla

Having Bugzilla installed, you can use a Perl script to test your installation:

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

The output will resemble the following:

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://203.0.113.1/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.

Finally, point your favorite web browser to http://203.0.113.1/ to access your Bugzilla site.

On the Bugzilla web interface, click the Log In button and then input the administrator's credentials to log in. Then you can continue to setup Bugzilla as you wish.

Step 7: Install and configure the Apache mod_perl module (Optional)

In order to improve Apache's performance when running Perl scripts, it's recommended to enable Apache's mod_perl module as follows:

sudo yum install mod_perl mod_perl-devel -y

You can use the following command to confirm the installation:

apachectl -M | grep perl

The result will be:

perl_module (shared)

Modify Perl-related settings in one of the Apache config files:

sudo vi /etc/httpd/conf.d/perl.conf

Display line numbers:

:set nu

Uncomment lines 15 and 24:

PerlSwitches -w
PerlSwitches -T

Append a new line to the end of the file:

PerlConfigRequire /var/www/html/bugzilla/mod_perl.pl

Save and quit:

:wq!

Restart Apache to load the new config:

sudo systemctl restart httpd.service

Want to contribute ?

You could earn up to $300 by adding new articles