How to Install Bugzilla Bug Tracker on Ubuntu Server 20.04 Tutorial

How to Install Bugzilla Bug Tracker on Ubuntu Server 20.04. Bugs are errors or defects found in any computer system. They will stay in your software until someone removes them. It is important to removes your system bugs and issues as it might lead to unhappy customers, revenue loss or stops your project development. To manage bugs effectively, you need a bug tracking solution, like a modern bug tracking tool. In this tutorial we will introduce what is Bugzilla bug tracker is together with it’s features and move onto installation phase on ubuntu 20.04. Let’s start!

What is Bugzilla

Bugzilla is a free, open source and one of the most popular bug tracking tools. Bugzilla is called Defect Tracking System or Bug Tracking System for your project management. That systems allow developers to keep track of outstanding bugs in their product effectively. It is written in Perl language and uses MariaDB as a database backend. It is self hosted and designed for small to large projects. It is used by many organizations, including, Eclipse, Apache, Mozilla Foundation, WebKit, KDE, LibreOffice, etc. The bug tracking system allows developers to monitor and track of outstanding problems with their products. You can also use it as a test management tool because it can be integrated with other Test case management tools such as Quality Center, Testlink, etc.

Bugzilla Features

  • Advanced search capabilities.
  • Excellent Security to prevent Cross Site Scripting. 
  • Custom Workflow and Custom Fields.
  • Patch Viewer.
  • Automatic Duplicate Bug Detection.
  • Multiple Authentication Methods (LDAP, Apache Web server).
  • Move Bugs Between Installations.
  • Support for Multiple Database Engines: MySQL, PostgreSQL. 
  • User configurable email notifications of bug changes.
  • Inter bug dependency tracking and graphing.
  • Simple, user friendly and customizable web user interface.
  • Automatic duplicate bug detection.
  • Reports and charts.
  • Allows you to watch other users.

Follow this post to show you how to install the Bugzilla bug tracker on Ubuntu server 20.04.

How to Install Bugzilla Bug Tracker on Ubuntu Server 20.04

Install Required Dependencies

Bugzilla is written in Perl language, so you will need to install the Perl package and other required dependencies on your server. You can install all of them by running the following command:

				
					apt-get install perl 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 graphviz sphinx-common rst2pdf libemail-address-perl libemail-reply-perl -y
				
			

After installing all the dependencies, verify the Perl version using the following command:

				
					perl -v
				
			

You will get the Perl version in the following output:

				
					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 Webserver

Now you will need to install the Apache webserver to host Bugzilla on the internet. You can install it by running the following command:

				
					apt-get install apache2 -y
				
			

Once the Apache web server is installed, start the Apache service and enable it to start at system reboot:

				
					systemctl start apache2
systemctl enable apache2
				
			

After installing the Apache web server, you can proceed to install the MariaDB database server.

Install and Configure MariaDB Database Server

Bugzilla uses the MariaDB as a database backend. So you will need to install the MariaDB on your server. You can install it by running the following command:

				
					apt-get install mariadb-server mariadb-client -y
				
			

Once the MariaDB is installed, start the MariaDB service and enable it to start at system reboot:

				
					systemctl start mariadb
systemctl enable mariadb

				
			

Next, secure the MariaDB installation using the following command:

				
					mariadb-secure-installation
				
			

You will be asked to set a new password, remove the test database, disallow remote root login and remove the anonymous users as shown below:

				
					Enter current password for root (enter for none): <ENTER>
OK, successfully used password, moving on...

Change the root password? [Y/n] y
New password: <ENTER NEW PASSWORD>
Re-enter new password: <RE-ENTER NEW 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

				
			

Once your MariaDB is secured, log in to the MariaDB shell using the following command:

				
					mysql -u root -p
				
			

Once you are logged in, create a database and user for Bugzilla with the following command:

				
					CREATE DATABASE bugzilladb;
CREATE USER 'bugzillauser'@'localhost' IDENTIFIED BY 'securepassword';
				
			

Next, grant all the privileges to the Bugzilla database with the following command:

				
					GRANT ALL PRIVILEGES ON bugzilladb.* TO 'bugzillauser'@'localhost';
				
			

Here flush the privileges and exit from the MariaDB shell with the following command:

				
					FLUSH PRIVILEGES;
EXIT;
				
			

Then edit the MariaDB configuration file and tweak some settings:

				
					nano /etc/mysql/mariadb.conf.d/50-server.cnf
				
			

Add the following lines inside the [mysqld] section:

				
					max_allowed_packet=16M
ft_min_word_len=2

				
			

Save and close the file when you are done. Then, restart the MariaDB service to apply the changes:

				
					systemctl restart mariadb
				
			

Install Bugzilla on Ubuntu 20.04

Next, go to the Bugzilla download page and download the latest version of Bugzilla using the following command:

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

Once the Bugzilla is downloaded, create a directory for Bugzilla and extract downloaded file inside the Bugzilla directory:

				
					mkdir /var/www/html/bugzilla
tar xf bugzilla-5.0.6.tar.gz -C /var/www/html/bugzilla --strip-components=1
				
			

Please change the ownership and permission of the Bugzilla directory:

				
					chown -R www-data:www-data /var/www/html/bugzilla/
chmod -R 755  /var/www/html/bugzilla/
				
			

Next, navigate to the Bugzilla directory and check all Perl modules with the following command:

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

Here run the following command to install all missing Perl modules:

				
					/usr/bin/perl install-module.pl --all
				
			

You will get the following output:

				
					chmod 755 blib/arch/auto/DBD/SQLite/SQLite.so
Manifying 7 pod documents
  ISHIGAKI/DBD-SQLite-1.70.tar.gz
  /usr/bin/make -- OK
  ISHIGAKI/DBD-SQLite-1.70.tar.gz
  Skipping test because of notest pragma
Running make install for ISHIGAKI/DBD-SQLite-1.70.tar.gz
"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- SQLite.bs blib/arch/auto/DBD/SQLite/SQLite.bs 644
Manifying 7 pod documents
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/auto/DBD/SQLite/SQLite.so
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/auto/share/dist/DBD-SQLite/sqlite3ext.h
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/auto/share/dist/DBD-SQLite/sqlite3.c
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/auto/share/dist/DBD-SQLite/sqlite3.h
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/DBD/SQLite.pm
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/DBD/SQLite/Cookbook.pod
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/DBD/SQLite/VirtualTable.pm
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/DBD/SQLite/GetInfo.pm
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/DBD/SQLite/Fulltext_search.pod
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/DBD/SQLite/Constants.pm
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/DBD/SQLite/VirtualTable/PerlData.pm
Installing /var/www/html/bugzilla/lib/x86_64-linux-gnu-thread-multi/DBD/SQLite/VirtualTable/FileContent.pm
Installing /var/www/html/bugzilla/lib/man/man3/DBD::SQLite::Constants.3pm
Installing /var/www/html/bugzilla/lib/man/man3/DBD::SQLite::VirtualTable::PerlData.3pm
Installing /var/www/html/bugzilla/lib/man/man3/DBD::SQLite::VirtualTable.3pm
Installing /var/www/html/bugzilla/lib/man/man3/DBD::SQLite.3pm
Installing /var/www/html/bugzilla/lib/man/man3/DBD::SQLite::Fulltext_search.3pm
Installing /var/www/html/bugzilla/lib/man/man3/DBD::SQLite::VirtualTable::FileContent.3pm
Installing /var/www/html/bugzilla/lib/man/man3/DBD::SQLite::Cookbook.3pm
  ISHIGAKI/DBD-SQLite-1.70.tar.gz
  /usr/bin/make install  -- OK

				
			

Next, create a localconfig file and define the Bugzilla database and other settings:

				
					nano /var/www/html/bugzilla/localconfig
				
			

Add the following lines:

				
					$create_htaccess = 1;
$webservergroup = 'www-data';
$use_suexec = 1;
$db_driver = 'mysql';
$db_host = 'localhost';
$db_name = 'bugzilladb';
$db_user = 'bugzillauser';
$db_pass = 'securepassword';
$db_port = '3306';

				
			

Next, comment out the $var variable in Util.pm file:

				
					sed -i 's/^.*$var =~ tr/#&/' /var/www/html/bugzilla/Bugzilla/Util.pm
				
			

Enable the required Apache modules with the following command:

				
					a2enmod headers env rewrite expires cgi
				
			

Restart the Apache service to apply the changes:

				
					systemctl restart apache2
				
			

Run the checksetup.pl script again to validate the database connection and to build the needed database tables and other configuration settings.

				
					./checksetup.pl
				
			

You will be asked to set an administrator account as shown below:

				
					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: hitjethva@gmail.com
Enter the real name of the administrator: Hitesh Jethva
Enter a password for the administrator account: 
Please retype the password to verify: 
hitjethva@gmail.com 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.
				
			

Configure Apache for Bugzilla

Next, you will need to create an Apache virtual host configuration file for Bugzilla. You can create it with the following command:

				
					nano /etc/apache2/sites-available/bugzilla.conf
				
			

Add the following lines:

				
					<VirtualHost *:80>
ServerName bugzilla.example.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 close the file then activate the Apache virtual host file with the following command:

				
					a2ensite bugzilla.conf
				
			

Now restart the Apache service to apply the configuration changes:

				
					systemctl restart apache2
				
			

You can verify the Apache running status using the following command:

				
					systemctl status apache2
				
			

You should get the following output:

				
					● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-05-12 06:07:25 UTC; 4s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 26121 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 26136 (apache2)
      Tasks: 56 (limit: 2348)
     Memory: 5.6M
     CGroup: /system.slice/apache2.service
             ├─26136 /usr/sbin/apache2 -k start
             ├─26137 /usr/sbin/apache2 -k start
             ├─26138 /usr/sbin/apache2 -k start
             └─26139 /usr/sbin/apache2 -k start

May 12 06:07:25 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...
				
			

Next, verify the Bugzilla installation using the following command:

				
					/var/www/html/bugzilla/testserver.pl http://bugzilla.example.com
				
			

If everything is fine, you will get the following output:

				
					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.example.com/localconfig.
TEST-WARNING Failed to run gdlib-config; can't compare GD versions.
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.
				
			

Access Bugzilla Web Interface

Now, open your web browser and access the Bugzilla web interface using the URL http://bugzilla.example.com. You will be redirected to the Bugzilla welcome page:

Click on the Login button, provide your admin username, password and click on the Log in button. You should see the Bugzilla dashboard on the following page:

How to Install Bugzilla Bug Tracker on Ubuntu Server 20.04 Conclusion

Congratulations! You have successfully installed the Bugzilla bug tracker on Ubuntu 20.04 server. You can now host Bugzilla in your development environment and manage your application bugs via the Bugzilla dashboard.

Avatar for Hitesh Jethva
Hitesh Jethva

I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.

5 1 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x