Bugzilla 4 Installation on Ubuntu Linux Server 12.04

As the lead software engineer for a small software house, I often have to execute sysadmin tasks. One of them was to set up a bug-issue tracker in order to improve software quality and of course make the lives of the team members easier.

The one-and-only bug-issue tracker out there in my not-so-humble opinion is Bugzilla. It’s simplistic and straight to the point as well as developer friendly and open-source. So the task was narrowed down to

“Installing Bugzilla 4 on an Ubuntu Linux Server 12.04”

It may sound as a simple task, but the procedure contains some common pitfalls that are quite frustrating especially for a non sysadmin.

At this point I will assume that you already have both Apache and MySQL server installed. Bugzilla works also with other database and web servers, but in my case these two are used. Also I assume that you have created a database user for bugzilla as well as an empty database schema.

Just a little hint here, make sure that your bugzilla database user has the following rights on the bugzilla database schema.

Login:

$ mysql -u root -p

…and execute the following query:

mysql> GRANT SELECT, INSERT UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, 
CREATE TEMPORARY TABLES, DROP, REFERENCES 
ON bugzilla.* 
TO bugzilla@localhost IDENTIFIED BY 'db_user_password_here';

mysql>FLUSH PRIVILEGES;

mysql>quit

Now, the whole procedure starts from downloading the latest stable version of Bugzilla tarball.

$ wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.2.5.tar.gz

Now that you have downloaded the tarball, it’s time extract to your webserver’s directory. For my case this is:

$ tar zxvf bugzilla-4.2.5.tar.gz
$ mkdir /var/www/bugzilla  # or wherever you want
$ mv -R bugzilla-4.2.5.tar.gz/* /var/www/bugzilla  # or wherever you created the directory

So far, so good. Let’s check how the perl modules are doing. While being in the bugzilla directory (/var/www/bugzilla), execute the following perl scripts.

$ /usr/bin/perl checksetup.pl --check-modules
$ /usr/bin/perl install-module.pl
$ /usr/bin/perl checksetup.pl

This hopefully does the trick. If you have any implications with perl modules -missing repositories in apt-, “Google shall be your friend once again”.

If all perl modules are installed correctly, it’s time to set up bugzilla’s installation parameters. While being in the bugzilla directory again, edit the localconfig file, using emacs, vim, nano or your favourite editor.

The variables that must be changed are the following:

$webservergroup = 'www-data';  # or apache2 usually
$db_driver = 'mysql';          
$db_host = 'localhost';        
$db_name = 'bugzilla';         
$db_user = 'bugzilla';         
$db_pass = 'aPassword';

These were the mandatory changes on the localconfig file. Now you have to re-run the checksetup script:

 $ ./checksetup.pl

Expect to be asked about the Bugzilla Administrator account as well as password.

The worst part of the installation for me was to properly configure the Virtual Host of the Apache Server to execute cgi files outside cgi-bin folders which is the default.

You can edit your site configuration here:

$ cd /etc/apache2/sites-enabled
$ sudo nano whatever # name of your bugzilla VirtualHost

Below you can see my personal setting that “just-works”.

The brackets are missing because the blog’s code plugin is sucking balls or I don’t know how to use it 100% properly. Eitherway, find them and put them yourself, and get a chance to read if the config suits you before you blindly copy paste and break things, like I myself many times do.

VirtualHost *:80 #the plugin messes up the tags<>
        ServerAdmin alexhughes117@gmail.com

        DocumentRoot /var/www

        Directory /var/www/#the plugin messes up the tags<>
                AddHandler cgi-script .cgi
                Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
                AllowOverride All
                Order allow,deny
                Allow from all
        /Directory

        #Commented out because it was messing up bugzilla big time

        #ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        #Directory "/usr/lib/cgi-bin"
        #       AllowOverride All
        #       Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        #       Order allow,deny
        #       Allow from all
        #/Directory

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    Directory "/usr/share/doc/"
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    /Directory
/VirtualHost

Bugzilla should now work on your setup too. If not, make sure apache’s mod_perl or mod_cgi are installed and enabled as well as properly configured.

I hope you found this post a “helpful tool for your quest”.

Feel free to ask questions or report any mistake-typo I might have made.

Cheerio!

Leave a Reply