Bugzilla is a powerful, open-source bug tracking system widely used to manage and monitor issues in software development. If you’re running an Nginx server on Ubuntu 22.04 and want to implement Bugzilla for bug tracking, this guide will walk you through the simple process of installing and integrating it with Nginx.
Ubuntu 22.04: Installing Bugzilla Bug Tracker on Nginx Servers
Prerequisites:
- A working Nginx server installation.
- A working MySQL or MariaDB database installation.
- Download and install Git on your system.
Important: The following steps are lengthy and require some knowledge of Ubuntu. Please read through all steps carefully before proceeding. I will strive to illustrate these steps concisely and simply to help you successfully install Bugzilla on Ubuntu versions 20.04/22.04 and 24.04.
Step 1: Install Essential Packages
Before diving into the Bugzilla installation, ensure your Ubuntu 22.04 system has the necessary software packages and libraries.
sudo apt update
sudo apt install -y build-essential libmysqlclient-dev libgd-dev libexpat1-dev libssl-dev libperl-dev perl-modules libfile-mimeinfo-perl
Step 2: Install Perl and Required Modules
Bugzilla is built on Perl, so you’ll need to install Perl along with the necessary modules for it to function correctly.
sudo apt install -y perl
sudo cpan install App::cpanminus
sudo cpanm install DateTime Email::Send Email::MIME Email::MIME::Modifier Template Text::ParseWords List::MoreUtils Math::Random::ISAAC MIME::Parser File::Slurp
Step 3: Download and Install Bugzilla
Clone Bugzilla from the Git repository and install it.
sudo mkdir -p /var/www/vhosts/
cd /var/www/vhosts/
sudo git clone https://github.com/bugzilla/bugzilla.git
After cloning, you can switch to the stable branch if desired.
Checking Perl Modules (Important)
cd /var/www/vhosts/bugzilla
sudo ./checksetup.pl --check-modules
The module check is a crucial step in the Bugzilla installation process, and it’s where most errors occur. Since we’re using Nginx, you can safely ignore any error messages related to .htaccess
or Apache modules. These modules are not required for Bugzilla to run on Nginx, so skipping them won’t affect the installation.
Required Perl Modules:
The following Perl modules are essential for Bugzilla to function correctly:
/usr/bin/perl install-module.pl GD
/usr/bin/perl install-module.pl Chart::Lines
/usr/bin/perl install-module.pl Template::Plugin::GD::Image
/usr/bin/perl install-module.pl GD::Text
/usr/bin/perl install-module.pl GD::Graph
/usr/bin/perl install-module.pl PatchReader
/usr/bin/perl install-module.pl Net::LDAP
/usr/bin/perl install-module.pl Authen::Radius
/usr/bin/perl install-module.pl SOAP::Lite
/usr/bin/perl install-module.pl XMLRPC::Lite
/usr/bin/perl install-module.pl JSON::RPC
/usr/bin/perl install-module.pl Test::Taint
/usr/bin/perl install-module.pl HTML::Scrubber
/usr/bin/perl install-module.pl Encode::Detect
/usr/bin/perl install-module.pl Email::Reply
/usr/bin/perl install-module.pl HTML::FormatText::WithLinks
/usr/bin/perl install-module.pl TheSchwartz
/usr/bin/perl install-module.pl Daemon::Generic
/usr/bin/perl install-module.pl mod_perl2
/usr/bin/perl install-module.pl File::Which
Optional: Install All Optional Modules
To unlock all of Bugzilla’s features and capabilities, you have the option to install all of its optional Perl modules. This can be done with a single command:
/usr/bin/perl install-module.pl --all
Run checksetup.pl to Configure Bugzilla
Run the checksetup.pl
script to install Bugzilla and create the configuration file.
sudo ./checksetup.pl
Step 4: Create MySQL User/Database
Log in to MySQL to create a database and user for Bugzilla.
CREATE DATABASE bugzilla;
CREATE USER 'bugzilla'@'localhost' IDENTIFIED BY "bugzilla";
GRANT ALL PRIVILEGES ON bugzilla.* TO 'bugzilla'@'localhost' IDENTIFIED BY 'bugzilla';
FLUSH PRIVILEGES;
Step 5: Configure Bugzilla
The localconfig
file is located in the root directory of your Bugzilla installation (e.g., /var/www/vhosts
/bugzilla
). You can use any code editor, such as Visual Studio Code, Sublime Text, or nano, to open and edit it.
Alternatively, you can edit the localconfig
file directly using a command-line editor like nano
:
sudo nano /var/www/vhosts/bugzilla/localconfig
Edit the configuration with the SQL information you created for Bugzilla in Step 4.
$db_host = 'localhost';
$db_name = 'bugzilla';
$db_user = 'bugzilla';
$db_pass = 'bugzilla';
Run checksetup.pl
again to finalize the configuration:
sudo ./checksetup.pl
Step 6: Configure Nginx for Bugzilla
Create the Nginx configuration file for Bugzilla.
sudo nano /etc/nginx/sites-available/bugzilla.conf
Add the following content to the file:
server {
listen 80;
listen [::]:80;
server_name bugzilla.arriveddev.com;
return 301 https://bugzilla.arriveddev.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443;
server_name bugzilla.arriveddev.com;
ssl_certificate /etc/nginx/ssl/bugzilla.arriveddev.com/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/bugzilla.arriveddev.com/privkey.pem;
include /etc/nginx/ssl/options-ssl-nginx.conf;
ssl_dhparam /etc/nginx/ssl/ssl-dhparams.pem;
root /var/www/vhosts/bugzilla;
index index.cgi index.html;
location / {
try_files $uri $uri/ index.cgi;
}
location ~ \.cgi$ {
gzip off;
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME /var/www/vhosts/bugzilla/$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/www/vhosts/bugzilla;
}
}
Restart Nginx.
sudo systemctl restart nginx
Step 7: Configure FastCGI (fcgiwrap)
Bugzilla uses CGI scripts, so you need to install and configure fcgiwrap to handle these scripts.
1. Install fcgiwrap:
sudo apt-get install fcgiwrap
2. Create a socket file for fcgiwrap:
sudo nano /etc/systemd/system/fcgiwrap.socket
Add the following configuration to the file:
[Unit]
Description=fcgiwrap socket
[Socket]
ListenStream=/var/run/fcgiwrap.socket
[Install]
WantedBy=sockets.target
3. Create a service file for fcgiwrap:
sudo nano /etc/systemd/system/fcgiwrap.service
Add the following configuration to the file:
[Unit]
Description=Simple CGI Server
After=network.target
[Service]
ExecStart=/usr/sbin/fcgiwrap
User=www-data
Group=www-data
StandardInput=socket
[Install]
WantedBy=multi-user.target
4. Start and enable fcgiwrap:
sudo systemctl enable fcgiwrap.socket
sudo systemctl start fcgiwrap.socket
Step 8: Set File Permissions
Ensure that the Bugzilla directory and its contents have the correct permissions. By default, the owner and group are set to www-data
, but you can assign ownership to a different user and group, such as your_user:www-data
.
Example:
sudo chown -R arriveddev:www-data /var/www/vhosts/bugzilla
sudo chmod -R 755 /var/www/vhosts/bugzilla
Step 9: Configure Bugzilla Email (Optional)
If your Ubuntu system already has a mail sending functionality installed, you can add a step to configure the email method in Bugzilla.
- Open the file bugzilla/data/params.json.
- Find the configuration “mail_delivery_method” : “Sendmail”.
- Set it to “mail_delivery_method” : “” or “mail_delivery_method”: “SMTP” if you’re using SMTP.
Step 10: Configure Bugzilla Domain (Optional)
In Step 6, we configured Nginx to use the domain bugzilla.arriveddev.com
. If you’re installing Bugzilla on a local Ubuntu machine (localhost), you’ll need to add this domain to your hosts file.
Open the file /etc/hosts
and add the configuration for the domain:
127.0.0.1 bugzilla.arriveddev.com
You have successfully installed and configured Bugzilla on your Ubuntu 22.04 server with Nginx. You can now access your Bugzilla instance by visiting https://bugzilla.arriveddev.com
in your web browser.
In our next article, we’ll guide you through creating your first bug report in Bugzilla, empowering you to effectively track and resolve software issues.