Ubuntu – How to install Bugzilla

bugzillasoftware installation

I would like to use Bugzilla on my own computer to track and trace bugs in our own software. How do I set this up?

Best Answer

For Bugzilla you need...

  • Perl (5.8.1 or above)
  • MySQL
  • Apache2
  • Bugzilla
  • Perl modules
  • Bugzilla using apache

Some remarks up front:

If any of these are already installed just keep an eye on settings that need to be set. Check these with what you used and change them to your needs.

If you need information about Perl, MySQL, Apache these are some LAMP how tos: 1, 2, 3, 4, 5.

Also have a look at this how to (from Saariko in comment) if the below does not work for you.

If anyone finds typos feel free to fix them, or if you can think of improvements feel free to add them in

Here we go...

  1. Perl

    Verify what perl you are using:

    perl -v
    

    It should show something like this:

    This is perl, v5.10.1 (*) built for i686-linux-gnu-thread-multi
    (with 53 registered patches, see perl -V for more detail)
    

    Natty uses 5.10. If yours is lower than 5.8.1 you need to upgrade it.

  2. MySQL

    Verify if you have a MySQL running with

    mysql --version
    

    If not installed install mysql-server Install mysql-servermysql-admin Install mysql-adminmysql-client

    Make sure to follow guidelines and set up a root account with a decent password. See the links above for how to set up a LAMP server if you need it. Create a user bugzilla (change it if you want something else)

    sudo useradd -d /home/bugzilla -m bugzilla
    sudo passwd bugzilla
    

    And create a database and set permissions for user bugzilla

    mysql -u root -p
    mysql> create database bugzilla;
    mysql> grant all privileges on bugzilla.* to bugzilla@localhost;
    

    You need database name, user name and password for the user later on.

  3. Apache

    Verify if Apache is installed:

    apache2 -v
    

    and

    http://localhost
    

    should show a welcome page or a website. If not installed...install apache2 Install apache2 Configure apache2 as you normally would. See the links at the top for how to set up a LAMP server if you need more.

    And now for the important part... setting up bugzilla in apache2:

    sudo -H gedit /etc/apache2/apache2.conf
    

    and edit in the following ...

    Alias /bugzilla/ /var/www/bugzilla/
    <directory /var/www/bugzilla>
    Addhandler cgi-script .cgi .pl
    Options +Indexes +ExecCGI +FollowSymLinks
    DirectoryIndex index.cgi
    AllowOverride Limit
    </directory>
    

    (Note the trailing "/" on the first line)

    Add a user apache2 if you do not have this already.

     sudo useradd -d /home/apache2 -m apache2
     sudo passwd apache2
    

    Add the user to apache2 variables...

    sudo -H gedit /etc/apache2/envvars
    

    and include

     export APACHE_RUN_USER=apache2
     export APACHE_RUN_GROUP=apache2
    

    The cgi addhandler could be in another place if you install bugzilla from the repositories (see apache cgi how to)

  4. Bugzilla

    Install bugzilla3 Install bugzilla3

    Or download the latest stable (4.0.2 at the moment) or latest cutting edge version from bugzilla. Short instruction on the latter:

     sudo tar -xvf bugzilla-4.0.2.tar
     sudo mv /download/bugzilla-4.0.2 /usr/local/
     sudo ln -s /usr/local/bugzilla-4.0.2 /var/www/bugzilla
    

    Make sure the directory has rw permissions:

     sudo chown -R www-data:www-data /var/www/bugzilla
    
  5. Perl modules for Bugzilla

    Bugzilla uses a script checksetup.pl to check if everything is set up correctly and if things changed to set them up for you. By manually installing the perl modules you can skip this.

    Check if all modules are installed:

     cd /var/www/bugzilla/
     sudo ./checksetup.pl --check-modules
    

    If not installed...

     sudo perl -MCPAN -e install
    

    localconfig holds the configurations and needs to be set up. So...

     sudo -H gedit localconfig
    

    and change $db_name to the database name, #db_user to the user and $db_password to the password you used during setup of MySQL.

     $db_name = 'bugzilla';
     $db_user = 'bugzilla';
     $db_pass = 'bugzilla@pwpspaswsword';
    

    After saving these settings

    cd /var/www/bugzilla/
    sudo ./checksetup.pl
    

    will add all kinds of tables to MySQL. Adding server group apache2 to bugzilla:

    sudo -H gedit /var/www/bugzilla/localconfig 
    

    and add

    $webservergroup = 'apache2';
    

    To include these changes do a

    cd /var/www/bugzilla/
    sudo ./checksetup.pl                       
    

    and this will ask you to setup your administrator for bugzilla.

  6. It works!!

    Restart apache2

    sudo /etc/init.d/apache2 restart
    

    and open a browser and insert URL

    http://localhost/bugzilla/ 
    

    and I have a working bugzilla login page on my own machine.