Setup Bugzilla on CentOS 7

Warning

This document is considered archived and is most likely no longer relevant in modern day environments.

The following steps can be used to install Bugzilla on CentOS 7. It is assumed you have a CentOS 7 system installed, updated (sudo yum update) and running.

Pprerequisites

  • System with CentOS 7 Installed

Steps

A series of non-base packages are required; so install the EPEL package:

$ sudo yum -y install epel-release

Install, configure and start Apache:

$ sudo yum -y install httpd mod_perl mod_ssl

$ sudo systemctl enable httpd
$ sudo systemctl start httpd

$ sudo firewall-cmd --permanent --add-service=http
$ sudo firewall-cmd --permanent --add-service=https
$ sudo firewall-cmd --reload

If desired, check if you have access to your HTTP server. Note that the mod_ssl package and HTTPS firewall exception is not required, but will prepare your system to support secure Bugzilla access.

Install, configure and start SQL server:

$ sudo yum -y install mariadb-server

(add `max_allowed_packet` option for larger Bugzilla attachments)
$ sudo vi /etc/my.cnf
   [mysqld]
       max_allowed_packet=20M

$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb

(configure your root-level password)
$ mysql -u root
   MariaDB [(none)]> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('myrootpw');
   MariaDB [(none)]> \q

(prepare Bugzilla's user and database)
$ mysql -u root -p
   MariaDB [(none)]> CREATE DATABASE bugs;
   MariaDB [(none)]> GRANT ALL ON bugs.* to bugs@localhost IDENTIFIED BY 'mydbpw';
   MariaDB [(none)]> \q

Install Bugzilla – we’ll be using Git to acquire Bugzilla sources for easy maintenance:

$ sudo yum -y install git

(add user to apache group and re-login)
$ sudo usermod -a -G apache `id -u -n`
$ exec su -l `id -u -n`

(prepare Bugzilla site)
$ cd /var/www/html/
$ sudo mkdir bugzilla
$ sudo chown apache:apache bugzilla
$ sudo chmod -R 2774 bugzilla
$ cd bugzilla/

(checkout desired Bugzilla release)
$ git init
$ git remote add origin https://github.com/bugzilla/bugzilla.git
$ git fetch origin
$ git checkout release-5.0-stable

Install Bugzilla modules – while Bugzilla can use Perl modules from the distribution, the tool will require some modules to be manually built/installed. We’ll install a required compiler and stock Perl modules, then use additional configuration/scripts to install/validate missing modules:

$ sudo yum -y install gcc perl*
$ /usr/bin/perl install-module.pl --all
$ ./checksetup.pl

Configure Bugzilla’s database password (and any additional options, if desired):

$ vi localconfig
   $db_pass = 'mydbpw';

Complete the Bugzilla setup:

$ ./checksetup.pl

Configure Bugzilla in Apache:

$ sudo vi /etc/httpd/conf.d/bugzilla.conf
---
<VirtualHost *:80>
    DocumentRoot /var/www/html/bugzilla/
</VirtualHost>

<Directory /var/www/html/bugzilla>
    AddHandler cgi-script .cgi
    Options +ExecCGI +Indexes
    DirectoryIndex index.cgi
    AllowOverride Authconfig FileInfo Indexes Limit Options
</Directory>
---

$ sudo systemctl restart httpd

Configure SELinux for Bugzilla usage:

$ sudo yum -y install policycoreutils-python

$ 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 -Rv /var/www/html/bugzilla/
$ sudo setsebool -P httpd_enable_cgi 1

(if you want to allow Bugzilla to check for updates)
$ sudo setsebool -P httpd_can_network_connect 1

(if you want to use memcache)
$ sudo setsebool -P httpd_can_network_memcache 1

Install and configure memcached (if desired):

$ sudo yum -y install memcached
$ sudo systemctl start memcached
$ sudo systemctl enable memcached

Browse to your Bugzilla instance using your preferred browser. Login using your initial Administrator account (using the E-mail and password provided during the checksetup.pl invoke). Ensure the (at least) following configuration options are configure to the follow or desired values:

Required Settings
    urlbase
        <adjust to your URL base>
    cookiepath
        <adjust to your URI porition of your base>
Attachments
    maxattachmentsize
        20000
Memcached
    memcached_servers
        127.0.0.1:11211