how to install bugzilla on ubuntu 22.04

How to Install Bugzilla on Ubuntu 22.04

Spread the love

Bugzilla is an open-source software for tracking bugs developed by Mozilla’s developers. It is written in Perl and supports various database systems such as MySQL, PostgreSQL, Oracle, and SQLite.

Bugzilla’s system requirements include a compatible database management system, a suitable release of Perl 5, an assortment of Perl modules, a compatible web server, and a qualified mail transfer agent.

Installing Bugzilla on Ubuntu 22.04 is a straightforward process and may take up to 10 minutes. Let’s get started!

Prerequisites

  • A server with Ubuntu 22.04 as the OS
  • At VPS with at least 4 GB of RAM available
  • User privileges: root or non-root user with sudo privileges

Step 1. Update the System

Since we have a fresh installation of Ubuntu 22.04, we need to update the packages to the latest versions available:

sudo apt update -y && sudo apt upgrade -y

Step 2. Install Perl

Bugzilla is written in Perl, so we need to install it along with of its dependencies.

sudo apt install build-essential 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 -y

After successful installation, check the installed Perl version:

perl --version

You should get output similar to this:

root@host:~# perl --version

This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-linux-gnu-thread-multi
(with 58 registered patches, see perl -V for more detail)

Step 3. Install MariaDB Database

To install the MariaDB database server, execute the command below.

sudo apt install mariadb-server -y

Start the MariaDB service and enable it to run at system startup with the following commands:

sudo systemctl start mariadb && sudo systemctl enable mariadb

Check the status of the MariaDB service like so:

sudo systemctl status mariadb

You should receive the following output:

root@host:~# sudo systemctl status mariadb
● mariadb.service - MariaDB 10.6.12 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2023-09-21 06:50:23 CDT; 18min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 88311 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 7 (limit: 4558)
     Memory: 59.4M
        CPU: 1.625s
     CGroup: /system.slice/mariadb.service
             └─88311 /usr/sbin/mariadbd

Step 4. Create Bugzilla database and user

To create the BugZilla database and user, log into the MariaDB command line as the root user:

mysql -u root -p

Then press [Enter] if you have not set a root password for MariaDB. Once logged in, execute the following commands on the MariaDB command line:

 CREATE USER 'bugzilla'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';
 CREATE DATABASE bugzilla;
 GRANT ALL PRIVILEGES ON bugzilla.* TO 'bugzilla'@'localhost';
 FLUSH PRIVILEGES;
 EXIT;

With that done, you should now have a database and user ready for Bugzilla.

Step 5. Install Apache2 Webserver

We are going to use Apache as a web server in this tutorial. To install it, execute the command below:

sudo apt install apache2 -y

After successful installation, start and enable the service:

sudo systemctl start apache2 && sudo systemctl enable apache2

To check if everything is OK, execute the following command for the status of the Apache2 service:

sudo systemctl status apache2

You should receive the following output:

root@host:~# sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2023-09-21 06:52:26 CDT; 25min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 93179 (/usr/sbin/apach)
      Tasks: 6 (limit: 4558)
     Memory: 13.3M
        CPU: 308ms
     CGroup: /system.slice/apache2.service

Step 6. Install Bugzilla

Download the latest stable version of Bugzilla into the Apache document root.

cd /var/www/html
wget https://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-5.0.6.tar.gz

Once downloaded, extract the bugzilla directory.

tar -xvf bugzilla-5.0.6.tar.gz -C /var/www/html/

mv bugzilla-5.0.6 bugzilla 

Once this is done, go into the “bugzilla” directory and run the checksetup script to check your system’s setup.

cd /var/www/html/bugzilla/

./checksetup.pl

If there are missing modules, you need to execute the following command:

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

Now, if you execute the ./checksetup.pl it will return the following output:

There was an error connecting to MySQL:

    Access denied for user 'bugs'@'localhost' (using password: NO)

This is normal and expected because we haven’t set up the configuration file yet. Open the file /var/www/html/bugzilla/localconfig with your preferred text editor and edit it to look like this:

$webservergroup = 'www-data';
$db_driver = 'mysql';
$db_host = 'localhost';
$db_name = 'bugzilla';
$db_user = 'bugzilla';
$db_pass = 'YourStrongPasswordHere';
$db_port = 0;

Save the file and close it. After these settings are done run the ./checksetup.pl again.

./checksetup.pl

It should return back with no errors.

Next is to define your administrator’s email, username and password once the database connection is successful.

Enter the e-mail address of the administrator: [email protected]
Enter the real name of the administrator: admin
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.

Step 7. Create a Virtual Host configuration file

To access the Bugzilla Web interface, you need to create a virtual host configuration file where you can define your domain, document root, and some script parameters.

First, create the configuration file with the following command:

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

Open the file, and paste the following lines of code:

<VirtualHost *:80>
ServerName yourdomain.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/yourdomain.com.error_log
CustomLog /var/log/apache2/yourdomain.com.access_log common
</VirtualHost>

Make sure to replace yourdomain.com with the actual domain name you plan on using.

Enable the Apache2 configuration file and other modules:

sudo a2ensite bugzilla.conf

sudo a2enmod headers env rewrite expires cgi

Check the syntax of the Apache2 configuration.

apachectl -t

You should receive the following output:

root@host:~# apachectl -t
Syntax OK

If you receive this output, you can safely restart the Apache service.

sudo systemctl restart apache2

With all of this finally configured, you can now access the Bugzilla Web interface at http://YourDomain.com.

Congratulations! You successfully installed and configured Bugzilla on Ubuntu 22.04. Of course, if you use one of our Linux server support services, you do not have to do this on your own – you can always contact our technical support and they will do the rest for you. We are available 24/7.

If you liked this post on how to install Bugzilla on Ubuntu 22.04, please share it with your friends on social networks or simply leave a reply below. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *