Preparation

For our testing we use QEMU to work with. So begin with a base install of OpenBSD on a QEMU qcow disk image and create a copy-on-write image to work on.

qemu-img create -b openbsd36.qemu -f qcow bugzilla.qemu

Pre-requisites

Download the following packages from OpenBSD packages: expat, freetype, gd, jpeg, mysql-client, mysql-server, p5-DBD-mysql, p5-DBI p5-GD, p5-Net-Daemon, p5-PlRPC, p5-Time-TimeDate, p5-XML-Parser, png.

Now boot up and pkg_add mysql-server and p5-GD, p5-Time-TimeDate and p5-XML-Parser. The other packages will be loaded to satisfy the OpenBSD package dependencies.

Next, configure MySQL - add the following to rc.local:

if [ X"${mysqld}" == X"YES" -a -x /usr/local/bin/mysqld_safe -a -r /etc/my.cnf ]; then
        /usr/local/bin/mysqld_safe --user _mysql > /dev/null 2>>amp;1 &
        echo -n ' mysqld'
fi

Edit /etc/rc.conf.local and add in the following:

mysqld=YES
httpd_flags=-u

Copy /usr/local/share/mysql/my-small.cnf to /etc/my.cnf and edit it required. We use max_allowed_packet=1M which is the default setting.

Secure MySQL

Now we can reboot the machine to check things are working or just start mysql manually. To secure it and setup the bugzilla account execute the following:

bash# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD ('new_password') WHERE user='root';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,
          DROP,REFERENCES ON bugs.* TO bugs@localhost 
          IDENTIFIED BY 'bugs_password';
mysql> FLUSH PRIVILEGES;

Note that the database name, user name and password should be looked up in the localconfig file for each bugzilla installation.

Configure Apache and run

Add a user bugadmin (id 1002) and groups bugzilla (id 112) or be prepared to sort out the ownership (see localconfig). We also expect www-data to be present (id 33). This last uid is the one apache runs as. Create the database: mysqladmin -u root -p create <databasename> Create the database code directory under /opt/bugzilla. Now unpack the bugzilla archive code files and then import the dump data.

Finally update the apache config file /var/www/conf/httpd.conf with a block like the following for each bugzilla database:

Alias /wirebugs  "/opt/bugzilla/wirebugs/"
Alias /wirebugs/ "/opt/bugzilla/wirebugs/"
<Directory "/opt/bugzilla/wirebugs/">
    Options Indexes FollowSymLinks MultiViews ExecCGI
    AllowOverride FileInfo AuthConfig Limit Options
    Order allow,deny
    Allow from all
</Directory>

then uncomment the "AddHandler cgi-script .cgi" line and check the ServerAdmin value. Now start apache with 'apachectl start' if it is not already running. Otherwise use 'apachectl graceful' to re-configure it.