Operating System CentOS

How to Install Bugzilla 5.2 on AlmaLinux 9 or Rocky Linux 9

Set up the Bugzilla 5.2 bug tracker on the RHEL 9 family with Apache, MariaDB and a Git checkout of the stable branch, replacing old CentOS 7 installs.

This guide installs Bugzilla 5.2, the current stable release of the bug tracker, on AlmaLinux 9, Rocky Linux 9 or CentOS Stream 9 with Apache and MariaDB. At the end you will have a working Bugzilla at http://your-server/bugzilla/ with an administrator account, ready for its first product and users.

CentOS 7 reached end of life in June 2024 and no longer receives security updates, so it is not a suitable base for a new installation. The RHEL 9 family replaces it, and the Bugzilla documentation covers RHEL and CentOS Stream with the EPEL repository enabled. The 5.0 series (last release 5.0.4.1) is now listed by the project as the old stable release; new installations should use 5.2.

Requirements

  • A server running AlmaLinux 9, Rocky Linux 9 or CentOS Stream 9, with a user that can run sudo.
  • Perl 5.14 or newer. The Perl shipped with the RHEL 9 family is far newer than that; confirm with perl -v.
  • A database. Bugzilla 5.2 supports MariaDB 10.0.5 or newer through the DBD::MariaDB Perl module, as well as MySQL, PostgreSQL, Oracle and SQLite. This guide uses the MariaDB packaged with the distribution.
  • A web server that can run CGI scripts. This guide uses Apache with its CGI module.

Step 1: Enable EPEL and install the packages

Several of the Perl modules Bugzilla needs are in EPEL, and some of their dependencies are in the CRB repository. Enable both:

sudo dnf install dnf-plugins-core
sudo dnf config-manager --set-enabled crb
sudo dnf install epel-release

Install Apache, MariaDB, Git, a compiler and the Perl modules. The 'perl(Name)' form asks dnf for whichever package provides that module:

sudo dnf install git httpd mariadb-server mariadb-devel gcc make \
  'perl(autodie)' 'perl(CGI)' 'perl(CPAN)' 'perl(Date::Format)' 'perl(DateTime)' \
  'perl(DateTime::TimeZone)' 'perl(DBI)' 'perl(DBD::MariaDB)' 'perl(DBIx::Connector)' \
  'perl(Digest::SHA)' 'perl(Email::MIME)' 'perl(Email::Sender)' 'perl(fields)' \
  'perl(JSON::XS)' 'perl(List::MoreUtils)' 'perl(Math::Random::ISAAC)' 'perl(Memoize)' \
  'perl(Moo)' 'perl(Safe)' 'perl(Template)' 'perl(URI)'

If dnf reports that one name cannot be found, remove it from the list and run the command again; Bugzilla can install its own copy of any missing module in step 4.

Step 2: Prepare MariaDB

Start the database server and run the hardening script, which sets up root access and removes the anonymous users and test database:

sudo systemctl enable --now mariadb
sudo mariadb-secure-installation

Bugzilla stores attachments in the database and searches short words such as "cc" and "ftp", so raise the packet limit and lower the full-text minimum word length. Create /etc/my.cnf.d/bugzilla.cnf:

[mysqld]
max_allowed_packet=16M
ft_min_word_len=2

Create the database user. Replace your-db-password with a strong password of your own and keep it for step 5. You do not need to create the database itself; Bugzilla's setup script does that.

sudo mariadb -u root -e "CREATE USER bugs@localhost IDENTIFIED BY 'your-db-password'"
sudo mariadb -u root -e "GRANT ALL PRIVILEGES ON bugs.* TO bugs@localhost"
sudo systemctl restart mariadb

Step 3: Download Bugzilla

The project recommends a Git checkout of the stable branch, which also makes later upgrades simple. Do not place Bugzilla in a cgi-bin directory or under a ScriptAlias.

sudo git clone --branch release-5.2-stable https://github.com/bugzilla/bugzilla /var/www/html/bugzilla
cd /var/www/html/bugzilla

Step 4: Check and complete the Perl modules

Run the module check. It lists every required and optional module with the version found and the version needed:

sudo ./checksetup.pl --check-modules

Bugzilla 5.2 requires Email::Sender 2.600 and Email::Address::XS 1.05, which are newer than the EPEL 9 packages at the time of writing. The bundled install-module.pl script installs a private copy inside the Bugzilla directory without touching the system Perl:

sudo ./install-module.pl Email::Sender Email::Address::XS

Run the check again and install any other module it still reports as missing in the same way. Optional modules (charts, LDAP, patch viewer and so on) can be added later; sudo ./install-module.pl --all installs everything that is missing in one go.

Step 5: Run checksetup.pl

The setup script runs twice. The first run writes a configuration file named localconfig:

sudo ./checksetup.pl

Open the file with sudo nano localconfig (or vi) and set these three values:

$webservergroup = 'apache';
$db_driver = 'mariadb';
$db_pass = 'your-db-password';

Run the script again. This time it creates the bugs database and its tables, compiles the templates, sets file permissions for the web server group and asks for the email address, name and password of the first administrator:

sudo ./checksetup.pl

Step 6: Configure Apache

Create /etc/httpd/conf.d/bugzilla.conf with the directory block from the Bugzilla documentation. It lets Apache execute the .cgi files and allows Bugzilla's own .htaccess files to protect its data directories:

<Directory /var/www/html/bugzilla>
  AddHandler cgi-script .cgi
  Options +ExecCGI +FollowSymLinks
  DirectoryIndex index.cgi index.html
  AllowOverride All
</Directory>

Start Apache and open the web ports in firewalld:

sudo systemctl enable --now httpd
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --reload

Step 7: SELinux

SELinux is enforcing by default on the RHEL 9 family, and the Bugzilla documentation does not cover it. With the default policy, CGI scripts must carry the httpd_sys_script_exec_t type and directories the scripts write to need httpd_sys_rw_content_t. A reasonable starting point is:

sudo dnf install policycoreutils-python-utils
sudo semanage fcontext -a -t httpd_sys_script_exec_t '/var/www/html/bugzilla/.*\.cgi'
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/bugzilla/data(/.*)?'
sudo restorecon -R /var/www/html/bugzilla

If pages still fail with a permission error, look at what was denied with sudo ausearch -m avc -ts recent and adjust the labels or booleans (for example httpd_can_sendmail for local mail delivery) rather than switching SELinux off.

Step 8: Test the installation

Bugzilla ships a self-test that checks the web server configuration:

sudo ./testserver.pl http://localhost/bugzilla/

When the tests pass, open http://203.0.113.10/bugzilla/ in a browser (use your server's address or hostname) and log in with the administrator account from step 5.

Step 9: Essential settings

Click Administration, then Parameters, and review at least the following:

  • urlbase in Required Settings: the public URL of the front page, for example https://bugs.example.com/bugzilla/. Links in notification emails are built from it.
  • ssl_redirect: turn it on once HTTPS works. Put a certificate in front of any Bugzilla reachable from the internet, because logins and API credentials travel over this connection.
  • The Email section: set mail_delivery_method to SMTP and fill in smtpserver, smtp_username, smtp_password, smtp_ssl and mailfrom for a mail server you are allowed to send through.
  • requirelogin and createemailregexp in User Authentication if the tracker should not be readable, or open for self-registration, by everyone.

The project's post-installation guide describes each parameter in detail.

Keeping Bugzilla up to date

Because the installation is a Git checkout of the stable branch, an update within the 5.2 series is two commands. Take a database dump first.

cd /var/www/html/bugzilla
sudo git pull
sudo ./checksetup.pl

checksetup.pl applies any schema changes and resets file permissions; it is safe to run at any time. Watch the security advisories on bugzilla.org so you know when an update matters.

Frequently asked questions

Can I still install Bugzilla 5.0.x?

The 5.0.4.1 tarball is still offered as the old stable release, but 5.2 is where fixes land. Note that 5.2 continues from 5.0.6, and the former 5.1.x development series was renamed 5.3.x and contains newer code, so you cannot move from 5.1.x to 5.2.

Is there a ready-made Bugzilla package for the RHEL 9 family?

The Bugzilla documentation mentions a packaged bugzilla for Fedora, which installs to /usr/share/bugzilla. For RHEL-compatible systems it describes the Git checkout used here, which also gives you control over when you upgrade.

Should I use mod_perl instead of CGI?

Only for a heavily used tracker. mod_perl is faster but the documentation warns it can use around 30 MB of memory per Apache child, recommends at least 2 GB of RAM, requires the prefork MPM and needs a full Apache restart after any file change. CGI is the default and is fine for small and medium teams.

Does the official quick start cover another distribution?

Yes. The project's quick start is written for Ubuntu Server LTS with Apache and MariaDB. The steps are the same as here apart from package names, the www-data web server group and Apache's sites-available layout.

Share story:

Continue reading other guides on How VPS.