Welcome to our tutorial on how to install Bugzilla bug tracker on Ubuntu 20.04. According to the About Bugzilla page, Bugzilla is a robust, featureful and mature defect-tracking system, or bug-tracking system. Defect-tracking systems allow teams of developers to keep track of outstanding bugs, problems, issues, enhancement and other change requests in their products effectively.
Features of Bugzilla
Bugzilla is featureful. You can read about its features on the Bugzilla features page.
Installing Bugzilla BT on Ubuntu 20.04
Prerequisites
Check the system OS, the hardware and software requirements as outlined on Bugzilla requirements page.
Install Bugzilla BT
Well, once you setup your server with your desired requirements, you can proceed to install Bugzilla.
Install Perl on Ubuntu 20.04
Perl is the core requirement of installing and running Bugzilla. Bugzilla 5.0 and newer require Perl 5.10.1. However, if possible you should install Perl 5.12 or newer, as these newer versions have some useful improvements which will make your life easier.
Run system update;
apt update
Install Perl on Ubuntu 20.04, and other required (including some optional) package dependencies.
apt install libappconfig-perl libdate-calc-perl libtemplate-perl libmime-tools-perl build-essential libdatetime-timezone-perl libdatetime-perl libemail-sender-perl libemail-mime-perl libemail-mime-perl libdbi-perl libdbd-mysql-perl libcgi-pm-perl libmath-random-isaac-perl libmath-random-isaac-xs-perl libapache2-mod-perl2 libapache2-mod-perl2-dev libchart-perl libxml-perl libxml-twig-perl perlmagick libgd-graph-perl libtemplate-plugin-gd-perl libsoap-lite-perl libhtml-scrubber-perl libjson-rpc-perl libdaemon-generic-perl libtheschwartz-perl libtest-taint-perl libauthen-radius-perl libfile-slurp-perl libencode-detect-perl libmodule-build-perl libnet-ldap-perl libfile-which-perl libauthen-sasl-perl libfile-mimeinfo-perl libhtml-formattext-withlinks-perl libgd-dev libmysqlclient-dev graphviz sphinx-common rst2pdf libemail-address-perl libemail-reply-perl
You can then verify the version of installed Perl on Ubuntu 20.04 using the command below;
perl -v
This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-gnu-thread-multi
(with 50 registered patches, see perl -V for more detail)
Copyright 1987-2019, Larry Wall
Install Apache Web Server
You can use any other web server of your preference, but this guide used Apache. Hence, you can install Apache on Ubuntu 20.04 by running the command below;
apt install apache2
Start and enable Apache service to run on system boot;
systemctl enable --now apache2
Install and Configure Bugzilla Database on Ubuntu 20.04
Install MariaDB database on Ubuntu 20.04
Similarly, for the database, you can use PostgreSQL instead. But this guide used MariaDB, instead. Check that we installed the MySQL perl module above. Hence, to install MariaDB on Ubuntu 20.04, run the command belows;
apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
add-apt-repository 'deb [arch=amd64] http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal main'
apt install mariadb-server mariadb-client
Start and enable MariaDB to run on system boot;
systemctl enable --now mariadb
Run MariaDB initial security script to disable remote root login, remove anonymous users, test databases.
mysql_secure_installation
Create the Bugzilla Database and Database User
Login to MariaDB and create the database and database user with all privileges granted. Be sure to replace the database name, user and the password accordingly.
mysql
create database bugzilla;
grant all on bugzilla.* to bugadmin@localhost identified by 'changeme';
Reload privileges table and exit the database;
flush privileges;
quit
Next, insert the lines below to /etc/my.cnf.d/server.cnf
file.
sed -i.bak '/^[mysqld]/a max_allowed_packet=16M\nft_min_word_len=2' /etc/mysql/mariadb.conf.d/50-server.cnf
Restart MariaDB;
systemctl restart mariadb
Download the latest stable release version of the Bugzilla source code from the downloads page and placing it under the your web root document folder.
wget https://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-5.0.6.tar.gz
mkdir /var/www/html/bugzilla
tar xf bugzilla-5.0.6.tar.gz -C /var/www/html/bugzilla --strip-components=1
Once you have place the Bugzilla source code under the web root directory, you can now check if any required perl module is missing by executing the command below;
sed -i 's/^.*$var =~ tr/#&/' /var/www/html/bugzilla/Bugzilla/Util.pm
cd /var/www/html/bugzilla/
./checksetup.pl
* This is Bugzilla 5.0.6 on perl 5.30.0
* Running on Linux 5.4.0-53-generic #59-Ubuntu SMP Wed Oct 21 09:38:44 UTC 2020
Checking perl modules...
Checking for CGI.pm (v3.51) ok: found v4.46
Checking for Digest-SHA (any) ok: found v6.02
Checking for TimeDate (v2.23) ok: found v2.24
Checking for DateTime (v0.75) ok: found v1.51
Checking for DateTime-TimeZone (v1.64) ok: found v2.38
Checking for DBI (v1.614) ok: found v1.643
Checking for Template-Toolkit (v2.24) ok: found v2.27
Checking for Email-Sender (v1.300011) ok: found v1.300034
Checking for Email-MIME (v1.904) ok: found v1.946
Checking for URI (v1.55) ok: found v1.76
Checking for List-MoreUtils (v0.32) ok: found v0.416
Checking for Math-Random-ISAAC (v1.0.1) ok: found v1.004
Checking for JSON-XS (v2.01) ok: found v4.02
Checking available perl DBD modules...
Checking for DBD-Pg (v2.7.0) not found
Checking for DBD-SQLite (v1.29) not found
Checking for DBD-Oracle (v1.19) not found
Checking for DBD-mysql (v4.001) ok: found v4.050
...
Reading ./localconfig...
OPTIONAL NOTE: If you want to be able to use the 'difference between two
patches' feature of Bugzilla (which requires the PatchReader Perl module
as well), you should install patchutils from:
http://cyberelk.net/tim/software/patchutils/
This version of Bugzilla contains some variables that you may want to
change and adapt to your local settings. The following variables are
new to ./localconfig since you last ran checksetup.pl:
create_htaccess, webservergroup, use_suexec, db_driver, db_host,
db_name, db_user, db_pass, db_port, db_sock, db_check,
db_mysql_ssl_ca_file, db_mysql_ssl_ca_path, db_mysql_ssl_client_cert,
db_mysql_ssl_client_key, index_html, interdiffbin, diffpath,
site_wide_secret
Please edit the file ./localconfig and then re-run checksetup.pl
to complete your installation.
To attempt an automatic install of every required and optional module with one command, do:
/usr/bin/perl install-module.pl --all
Configure Bugzilla Database Connection
Once you have created the Bugzilla MySQL/MariaDB database,and installed it to your web root directory, configure the database connection details. open the /var/www/html/bugzilla/localconfig configuration file and update the database connection details as created above.
vim /var/www/html/bugzilla/localconfig
...
# The name of the group that your web server runs as. On Red Hat
# distributions, this is usually "apache". On Debian/Ubuntu, it is
# usually "www-data".
$webservergroup = 'www-data';
...
# What SQL database to use.
$db_driver = 'mysql';
# The DNS name or IP address of the host that the database server runs on.
$db_host = 'localhost';
# The name of the database.
#$db_name = 'bugs';
$db_name = 'bugzilla';
# Who we connect to the database as.
#$db_user = 'bugs';
$db_user = 'bugadmin';
# Enter your database password here.
$db_pass = 'changeme';
...
# port for my database server."
$db_port = 0;
...
Save and exit the file.
Rerun the checksetup.pl script to verify the database connection and initialize some Bugzilla database schemas and create the required database tables and other configuration settings.
/var/www/html/bugzilla/checksetup.pl
...
Reading ./localconfig...
OPTIONAL NOTE: If you want to be able to use the 'difference between two
patches' feature of Bugzilla (which requires the PatchReader Perl module
as well), you should install patchutils from:
http://cyberelk.net/tim/software/patchutils/
Checking for DBD-mysql (v4.001) ok: found v4.050
Checking for MySQL (v5.0.15) ok: found v5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal
Adding new table bz_schema...
Initializing bz_schema...
Creating tables...
Converting attach_data maximum size to 100G...
Setting up choices for standard drop-down fields:
priority bug_severity rep_platform op_sys resolution bug_status
Creating ./data directory...
Creating ./data/assets directory...
Creating ./data/attachments directory...
Creating ./data/db directory...
...
Once the Bugzilla is done, you are then asked to set the Bugzilla admin email and name and password.
...
Looks like we don't have an administrator set up yet. Either this is
your first time using Bugzilla, or your administrator's privileges
might have accidentally been deleted.
Enter the e-mail address of the administrator: [email protected]
Enter the real name of the administrator: GenToo
Enter a password for the administrator account:
Please retype the password to verify:
[email protected] is now set up as an administrator.
Creating initial dummy product 'TestProduct'...
Now that you have installed Bugzilla, you should visit the 'Parameters'
page (linked in the footer of the Administrator account) to ensure it
is set up as you wish - this includes setting the 'urlbase' option to
the correct URL.
checksetup.pl complete.
Create Bugzilla Apache Site Configuration file
To be able to access Bugzilla web interface, you need to create its Apache site configuration file.
vim /etc/apache2/sites-available/bugzilla.conf
<VirtualHost *:80>
ServerName bugzilla.kifarunix-demo.com
DocumentRoot /var/www/html/bugzilla/
<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/apache2/bugzilla.error_log
CustomLog /var/log/apache2/bugzilla.access_log common
</VirtualHost>
Save and exit the configuration file.]
Enable Bugzilla site;
a2ensite bugzilla.conf
Enable the required modules;
a2enmod headers env rewrite expires cgi
Set the ownership of Bugzilla document root directory to Apache user;
chown -R www-data: /var/www/html/bugzilla/
Check Apache syntax;
apachectl -t
If no errors, restart it.
systemctl restart apache2
Testing the Bugzilla Installation
Once you are done with the installation and setup of Bugzilla on Ubuntu 20.04, you can run the testserver.pl script to verify the installation and testing.
/var/www/html/bugzilla/testserver.pl <URL to this Bugzilla installation>
For example, to test our setup;
/var/www/html/bugzilla/testserver.pl http://bugzilla.kifarunix-demo.com
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://bugzilla.kifarunix-demo.com/localconfig.
...
Accessing Bugzilla Web Interface
Once you have confirmed that all is fine, you can then access Bugzilla web interface via the url, http://bugzilla.kifarunix-demo.com
, of course as per this setup.
If UFW is running, open port 80 or 443 depending on whether you are using HTTP or HTTPS;
ufw allow 80/tcp
You can then navigate to the Bugzilla URL on the browser. Such an interface welcomes you.
You can then login using the administrator email and password you created above. You can as well create new accounts.
Navigate through the Bugzilla and manage your application bugs.
Further Reading
Other Tutorials
Install Bugzilla Bug Tracker on CentOS 8
Install Gitlab with SSL/TLS Certificate on Ubuntu 20.04
Configure Postfix to Use Gmail SMTP on CentOS 8
Configure ELK Stack Alerting with ElastAlert