# Installing Bugzilla

## Installation

If you just want to use Bugzilla, you do not need to install it. None of this chapter is relevant to you. Ask your Bugzilla administrator for the URL to access it over the web.

The Bugzilla server software is usually installed on Linux or Solaris. If you are installing on another OS, check before you start your installation to see if there are any special instructions.

As an alternative to following these instructions, you may wish to try Arne Schirmacher's unofficial and unsupported Bugzilla Installer, which installs Bugzilla and all its prerequisites on Linux or Solaris systems.

This guide assumes that you have administrative access to the Bugzilla machine. It not possible to install and run Bugzilla itself without administrative access except in the very unlikely event that every single prerequisite is already installed.

The installation process may make your machine insecure for short periods of time. Make sure there is a firewall between you and the Internet.

You are strongly recommended to make a backup of your system before installing Bugzilla (and at regular intervals thereafter :-).

In outline, the installation proceeds as follows:

1. Install Perl (&min-perl-ver; or above for non-Windows platforms; &min-perl-ver-win; for Windows)

2. Install a Database Engine

3. Install a Webserver

4. Install Bugzilla

5. Install Perl modules

6. Install a Mail Transfer Agent (Sendmail 8.7 or above, or an MTA that is Sendmail-compatible with at least this version)

7. Configure all of the above.

### Perl

Installed Version Test: `perl -v`

Any machine that doesn't have Perl on it is a sad machine indeed. If you don't have it and your OS doesn't provide official packages, visit . Although Bugzilla runs with Perl &min-perl-ver;, it's a good idea to be using the latest stable version.

### Database Engine

From Bugzilla 2.20, support is included for using both the MySQL and PostgreSQL database servers. You only require one of these systems to make use of Bugzilla.

#### MySQL

Installed Version Test: `mysql -V`

If you don't have it and your OS doesn't provide official packages, visit . You need MySQL version &min-mysql-ver; or higher.

Many of the binary versions of MySQL store their data files in `/var`. On some Unix systems, this is part of a smaller root partition, and may not have room for your bug database. To change the data directory, you have to build MySQL from source yourself, and set it as an option to `configure`.

If you install from something other than a packaging/installation system, such as .rpm (Redhat Package), .deb (Debian Package), .exe (Windows Executable), or .msi (Microsoft Installer), make sure the MySQL server is started when the machine boots.

#### PostgreSQL

Installed Version Test: `psql -V`

If you don't have it and your OS doesn't provide official packages, visit . You need PostgreSQL version &min-pg-ver; or higher.

If you install from something other than a packaging/installation system, such as .rpm (Redhat Package), .deb (Debian Package), .exe (Windows Executable), or .msi (Microsoft Installer), make sure the PostgreSQL server is started when the machine boots.

### Web Server

Installed Version Test: view the default welcome page at http://<your-machine>/

You have freedom of choice here, pretty much any web server that is capable of running CGI scripts will work. However, we strongly recommend using the Apache web server (either 1.3.x or 2.x), and the installation instructions usually assume you are using it. If you have got Bugzilla working using another webserver, please share your experiences with us by filing a bug in &bzg-bugs;.

If you don't have Apache and your OS doesn't provide official packages, visit .

### Bugzilla

Download a Bugzilla tarball (or check it out from CVS) and place it in a suitable directory, accessible by the default web server user (probably apache or www). Good locations are either directly in the main web space for your web server or perhaps in `/usr/local` with a symbolic link from the web space.

The default Bugzilla distribution is NOT designed to be placed in a `cgi-bin` directory. This includes any directory which is configured using the `ScriptAlias` directive of Apache.

Once all the files are in a web accessible directory, make that directory writable by your webserver's user. This is a temporary step until you run the `checksetup.pl` script, which locks down your installation.

### Perl Modules

Bugzilla's installation process is based on a script called `checksetup.pl`. The first thing it checks is whether you have appropriate versions of all the required Perl modules. The aim of this section is to pass this check. When it passes, proceed to .

At this point, you need to `su` to root. You should remain as root until the end of the install. To check you have the required modules, run:

    bash# ./checksetup.pl --check-modules

`checksetup.pl` will print out a list of the required and optional Perl modules, together with the versions (if any) installed on your machine. The list of required modules is reasonably long; however, you may already have several of them installed.

There is a meta-module called Bundle::Bugzilla, which installs all the other modules with a single command. You should use this if you are running Perl 5.6.1 or above.

The preferred way of installing Perl modules is via CPAN on Unix, or PPM on Windows (see ). These instructions assume you are using CPAN; if for some reason you need to install the Perl modules manually, see .

    bash# perl -MCPAN -e 'install "<modulename>"'

If you using Bundle::Bugzilla, invoke the magic CPAN command on it. Otherwise, you need to work down the list of modules that `checksetup.pl` says are required, in the order given, invoking the command on each.

Many people complain that Perl modules will not install for them. Most times, the error messages complain that they are missing a file in @INC. Virtually every time, this error is due to permissions being set too restrictively for you to compile Perl modules or not having the necessary Perl development libraries installed on your system. Consult your local UNIX systems administrator for help solving these permissions issues; if you are the local UNIX sysadmin, please consult the newsgroup/mailing list for further assistance or hire someone to help you out.

If you are using a package-based system, and attempting to install the Perl modules from CPAN, you may need to install the "development" packages for MySQL and GD before attempting to install the related Perl modules. The names of these packages will vary depending on the specific distribution you are using, but are often called `<packagename>-devel`.

Here is a complete list of modules and their minimum versions. Some modules have special installation notes, which follow.

Required Perl modules:

1. AppConfig (&min-appconfig-ver;)

2. CGI (&min-cgi-ver;)

3. Data::Dumper (&min-data-dumper-ver;)

4. Date::Format (&min-date-format-ver;)

5. DBI (&min-dbi-ver;)

6. DBD::mysql (&min-dbd-mysql-ver;) if using MySQL

7. DBD::Pg (&min-dbd-pg-ver;) if using PostgreSQL

8. File::Spec (&min-file-spec-ver;)

9. File::Temp (&min-file-temp-ver;)

10. Template (&min-template-ver;)

11. Text::Wrap (&min-text-wrap-ver;)

12. Mail::Mailer (&min-mail-mailer-ver;)

13. MIME::Base64 (&min-mime-base64-ver;)

14. MIME::Parser (&min-mime-parser-ver;)

15. Storable (&min-storable-ver;)

Optional Perl modules:

1. GD (&min-gd-ver;) for bug charting

2. Chart::Base (&min-chart-base-ver;) for bug charting

3. GD::Graph (&min-gd-graph-ver;) for bug charting

4. GD::Text::Align (&min-gd-text-align-ver;) for bug charting

5. XML::Parser (&min-xml-parser-ver;) for the XML interface

6. PatchReader (&min-patchreader-ver;) for pretty HTML view of patches

7. Image::Magick (&min-image-magick-ver;) for converting BMP image attachments to PNG

#### DBD::mysql

The installation process will ask you a few questions about the desired compilation target and your MySQL installation. For most of the questions the provided default will be adequate, but when asked if your desired target is the MySQL or mSQL packages, you should select the MySQL-related ones. Later you will be asked if you wish to provide backwards compatibility with the older MySQL packages; you should answer YES to this question. The default is NO.

A host of 'localhost' should be fine. A testing user of 'test', with a null password, should have sufficient access to run tests on the 'test' database which MySQL creates upon installation.

#### Template Toolkit (&min-template-ver;)

When you install Template Toolkit, you'll get asked various questions about features to enable. The defaults are fine, except that it is recommended you use the high speed XS Stash of the Template Toolkit, in order to achieve best performance.

#### GD (&min-gd-ver;)

The GD module is only required if you want graphical reports.

The Perl GD module requires some other libraries that may or may not be installed on your system, including `libpng` and `libgd`. The full requirements are listed in the Perl GD module README. If compiling GD fails, it's probably because you're missing a required library.

The version of the GD module you need is very closely tied to the `libgd` version installed on your system. If you have a version 1.x of `libgd` the 2.x versions of the GD module won't work for you.

#### Chart::Base (&min-chart-base-ver;)

The Chart::Base module is only required if you want graphical reports. Note that earlier versions that 0.99c used GIFs, which are no longer supported by the latest versions of GD.

#### GD::Graph (&min-gd-graph-ver;)

The GD::Graph module is only required if you want graphical reports.

#### GD::Text::Align (&min-gd-text-align-ver;)

The GD::Text::Align module is only required if you want graphical reports.

#### XML::Parser (&min-xml-parser-ver;)

The XML::Parser module is only required if you want to import XML bugs using the `importxml.pl` script. This is required to use Bugzilla's "move bugs" feature; you may also want to use it for migrating from another bug database. XML::Parser requires that the `expat` library is already installed on your machine.

#### PatchReader (&min-patchreader-ver;)

The PatchReader module is only required if you want to use Patch Viewer, a Bugzilla feature to show code patches in your web browser in a more readable form.

### Mail Transfer Agent (MTA)

Bugzilla is dependent on the availability of an e-mail system for its user authentication and for other tasks.

This is not entirely true. It is possible to completely disable email sending, or to have Bugzilla store email messages in a file instead of sending them. However, this is mainly intended for testing, as disabling or diverting email on a production machine would mean that users could miss important events (such as bug changes or the creation of new accounts).

For more information, see the "maildeliverymethod" parameter in .

On Linux, any Sendmail-compatible MTA (Mail Transfer Agent) will suffice. Sendmail, Postfix, qmail and Exim are examples of common MTAs. Sendmail is the original Unix MTA, but the others are easier to configure, and therefore many people replace Sendmail with Postfix or Exim. They are drop-in replacements, so Bugzilla will not distinguish between them.

If you are using Sendmail, version 8.7 or higher is required. If you are using a Sendmail-compatible MTA, it must be congruent with at least version 8.7 of Sendmail.

Consult the manual for the specific MTA you choose for detailed installation instructions. Each of these programs will have their own configuration files where you must configure certain parameters to ensure that the mail is delivered properly. They are implemented as services, and you should ensure that the MTA is in the auto-start list of services for the machine.

If a simple mail sent with the command-line 'mail' program succeeds, then Bugzilla should also be fine.

## Configuration

Poorly-configured MySQL and Bugzilla installations have given attackers full access to systems in the past. Please take the security parts of these guidelines seriously, even for Bugzilla machines hidden away behind your firewall. Be certain to read for some important security tips.

### localconfig

You should now run `checksetup.pl` again, this time without the `--check-modules` switch.

    bash# ./checksetup.pl

This time, `checksetup.pl` should tell you that all the correct modules are installed and will display a message about, and write out a file called, `localconfig`. This file contains the default settings for a number of Bugzilla parameters.

Load this file in your editor. The only value you need to change is $db_pass, the password for the user you will create for your database. Pick a strong password (for simplicity, it should not contain single quote characters) and put it here.

You may need to change the value of webservergroup if your web server does not run in the "apache" group. On Debian, for example, Apache runs in the "www-data" group. If you are going to run Bugzilla on a machine where you do not have root access (such as on a shared web hosting account), you will need to leave webservergroup empty, ignoring the warnings that `checksetup.pl` will subsequently display every time it in run.

The other options in the `localconfig` file are documented by their accompanying comments. If you have a slightly non-standard MySQL setup, you may wish to change one or more of the other "$db_*" parameters.

You may also wish to change the names of the priorities, severities, operating systems and platforms for your installation. However, you can always change these after installation has finished; if you then re-run `checksetup.pl`, the changes will get picked up.

### Database Server

This section deals with configuring your database server for use with Bugzilla. Currently and are available.

#### MySQL

MySQL's default configuration is very insecure. has some good information for improving your installation's security.

##### Allow large attachments

By default, MySQL will only accept packets up to 64Kb in size. If you want to have attachments larger than this, you will need to modify your `/etc/my.cnf` as below.

If you are using MySQL 4.0 or newer, enter:

      [mysqld]
      # Allow packets up to 1M
      max_allowed_packet=1M

If you are using an older version of MySQL, enter:

      [mysqld]
      # Allow packets up to 1M
      set-variable = max_allowed_packet=1M

There is also a parameter in Bugzilla called 'maxattachmentsize' (default = 1000 Kb) that controls the maximum allowable attachment size. Attachments larger than either the 'max_allowed_packet' or 'maxattachmentsize' value will not be accepted by Bugzilla.

This does not affect Big Files, attachments that are stored directly on disk instead of in the database. Their maximum size is controlled using the 'maxlocalattachment' parameter.

##### Allow small words in full-text indexes

By default, words must be at least four characters in length in order to be indexed by MySQL's full-text indexes. This causes a lot of Bugzilla specific words to be missed, including "cc", "ftp" and "uri".

MySQL can be configured to index those words by setting the ft_min_word_len param to the minimum size of the words to index. This can be done by modifying the `/etc/my.cnf` according to the example below:

      [mysqld]
      # Allow small words in full-text indexes
      ft_min_word_len=2

Rebuilding the indexes can be done based on documentation found at .

The ft_min_word_len parameter is only supported in MySQL v4 or higher.

##### Permit attachments table to grow beyond 4GB

By default, MySQL will limit the size of a table to 4GB. This limit is present even if the underlying filesystem has no such limit. To set a higher limit, follow these instructions.

Run the `MySQL` command-line client and enter:

      mysql> ALTER TABLE attachments
                AVG_ROW_LENGTH=1000000, MAX_ROWS=20000;

The above command will change the limit to 20GB. Mysql will have to make a temporary copy of your entire table to do this. Ideally, you should do this when your attachments table is still small.

This does not affect Big Files, attachments that are stored directly on disk instead of in the database.

##### Add a user to MySQL

You need to add a new MySQL user for Bugzilla to use. (It's not safe to have Bugzilla use the MySQL root account.) The following instructions assume the defaults in `localconfig`; if you changed those, you need to modify the SQL command appropriately. You will need the $db_pass password you set in `localconfig` in .

We use an SQL `GRANT` command to create a bugs user. This also restricts the bugsuser to operations within a database called bugs, and only allows the account to connect from localhost. Modify it to reflect your setup if you will be connecting from another machine or as a different user.

Run the `mysql` command-line client.

If you are using MySQL 4.0 or newer, enter:

      mysql> GRANT SELECT, INSERT,
               UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,
               CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.*
               TO bugs@localhost IDENTIFIED BY '$db_pass';
               mysql> FLUSH PRIVILEGES;

If you are using an older version of MySQL,the `LOCK TABLES` and `CREATE TEMPORARY TABLES` permissions will be unavailable and should be removed from the permissions list. In this case, the following command line can be used:

      mysql> GRANT SELECT, INSERT,
               UPDATE, DELETE, INDEX, ALTER, CREATE, DROP,
               REFERENCES ON bugs.* TO bugs@localhost IDENTIFIED BY
               '$db_pass';
               mysql> FLUSH PRIVILEGES;

#### PostgreSQL

If you are using PostgreSQL 8.0.1 or higher, then you will require to use a version of DBD::Pg which is equal to or greater than version 1.41

##### Add a User to PostgreSQL

You need to add a new user to PostgreSQL for the Bugzilla application to use when accessing the database. The following instructions assume the defaults in `localconfig`; if you changed those, you need to modify the commands appropriately. You will need the $db_pass password you set in `localconfig` in .

On most systems, to create the user in PostgreSQL, you will need to login as the root user, and then

     bash# su - postgres

As the postgres user, you then need to create a new user:

     bash$ createuser -U postgres -dAP bugs

When asked for a password, provide the password which will be set as $db_pass in `localconfig`. The created user will have the ability to create databases and will not be able to create new users.

##### Configure PostgreSQL

Now, you will need to edit `pg_hba.conf` which is usually located in `/var/lib/pgsql/data/`. In this file, you will need to add a new line to it as follows:

`host all bugs 127.0.0.1 255.255.255.255 md5`

This means that for TCP/IP (host) connections, allow connections from '127.0.0.1' to 'all' databases on this server from the 'bugs' user, and use password authentication (md5) for that user.

If you are using versions of PostgreSQL before version 8, you may also need to edit `postgresql.conf` , also usually found in the `/var/lib/pgsql/data/` folder. You will need to make a single line change, changing

`# tcpip_socket = false`

to

`tcpip_socket = true`

Now, you will need to restart PostgreSQL, but you will need to fully stop and start the server rather than just restarting due to the possibility of a change to `postgresql.conf`. After the server has restarted, you will need to edit `localconfig`, finding the `$db_driver` variable and setting it to `Pg` and changing the password in `$db_pass` to the one you picked previously, while setting up the account.

### checksetup.pl

Next, rerun `checksetup.pl`. It reconfirms that all the modules are present, and notices the altered localconfig file, which it assumes you have edited to your satisfaction. It compiles the UI templates, connects to the database using the 'bugs' user you created and the password you defined, and creates the 'bugs' database and the tables therein.

After that, it asks for details of an administrator account. Bugzilla can have multiple administrators - you can create more later - but it needs one to start off with. Enter the email address of an administrator, his or her full name, and a suitable Bugzilla password.

`checksetup.pl` will then finish. You may rerun `checksetup.pl` at any time if you wish.

### Web server

Configure your web server according to the instructions in the appropriate section. (If it makes a difference in your choice, the Bugzilla Team recommends Apache.) Regardless of which webserver you are using, however, ensure that sensitive information is not remotely available by properly applying the access controls in .

#### Apache httpd

To configure your Apache web server to work with Bugzilla, do the following:

1. Load `httpd.conf` in your editor. In Fedora and Red Hat Linux, this file is found in `/etc/httpd/conf`.

2. Apache uses `<Directory>` directives to permit fine-grained permission setting. Add the following lines to a directive that applies to the location of your Bugzilla installation. (If such a section does not exist, you'll want to add one.) In this example, Bugzilla has been installed at `/var/www/html/bugzilla`.

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

   These instructions: allow apache to run .cgi files found within the bugzilla directory; instructs the server to look for a file called `index.cgi` if someone only types the directory name into the browser; and allows Bugzilla's `.htaccess` files to override global permissions.

   It is possible to make these changes globally, or to the directive controlling Bugzilla's parent directory (e.g. `<Directory /var/www/html/>`). Such changes would also apply to the Bugzilla directory... but they would also apply to many other places where they may or may not be appropriate. In most cases, including this one, it is better to be as restrictive as possible when granting extra access.

3. `checksetup.pl` can set tighter permissions on Bugzilla's files and directories if it knows what group the webserver runs as. Find the `Group` line in `httpd.conf`, place the value found there in the $webservergroup variable in `localconfig`, then rerun `checksetup.pl`.

4. Optional: If Bugzilla does not actually reside in the webspace directory, but instead has been symbolically linked there, you will need to add the following to the `Options` line of the Bugzilla `<Directory>` directive (the same one as in the step above):

        +FollowSymLinks

   Without this directive, Apache will not follow symbolic links to places outside its own directory structure, and you will be unable to run Bugzilla.

#### Microsoft Internet Information Services

If you are running Bugzilla on Windows and choose to use Microsoft's Internet Information Services or Personal Web Server you will need to perform a number of other configuration steps as explained below. You may also want to refer to the following Microsoft Knowledge Base articles: 245225 HOW TO: Configure and Test a PERL Script with IIS 4.0, 5.0, and 5.1 (for Internet Information Services) and 231998 HOW TO: FP2000: How to Use Perl with Microsoft Personal Web Server on Windows 95/98 (for Personal Web Server).

You will need to create a virtual directory for the Bugzilla install. Put the Bugzilla files in a directory that is named something other than what you want your end-users accessing. That is, if you want your users to access your Bugzilla installation through http://<yourdomainname>/Bugzilla, then do not put your Bugzilla files in a directory named Bugzilla. Instead, place them in a different location, and then use the IIS Administration tool to create a Virtual Directory named "Bugzilla" that acts as an alias for the actual location of the files. When creating that virtual directory, make sure you add the Execute (such as ISAPI applications or CGI) access permission.

You will also need to tell IIS how to handle Bugzilla's .cgi files. Using the IIS Administration tool again, open up the properties for the new virtual directory and select the Configuration option to access the Script Mappings. Create an entry mapping .cgi to:

    <full path to perl.exe >\perl.exe -x<full path to Bugzilla> -wT "%s" %s

For example:

    c:\perl\bin\perl.exe -xc:\bugzilla -wT "%s" %s

The ActiveState install may have already created an entry for .pl files that is limited to GET,HEAD,POST. If so, this mapping should be removed as Bugzilla's .pl files are not designed to be run via a webserver.

IIS will also need to know that the index.cgi should be treated as a default document. On the Documents tab page of the virtual directory properties, you need to add index.cgi as a default document type. If you wish, you may remove the other default document types for this particular virtual directory, since Bugzilla doesn't use any of them.

Also, and this can't be stressed enough, make sure that files such as `localconfig` and your `data` directory are secured as described in .

### Bugzilla

Your Bugzilla should now be working. Access `http://<your-bugzilla-server>/` - you should see the Bugzilla front page. If not, consult the Troubleshooting section, .

The URL above may be incorrect if you installed Bugzilla into a subdirectory or used a symbolic link from your web site root to the Bugzilla directory.

Log in with the administrator account you defined in the last `checksetup.pl` run. You should go through the parameters on the Edit Parameters page (see link in the footer) and see if there are any you wish to change. They key parameters are documented in ; you should certainly alter `maintainer` and `urlbase`; you may also want to alter `cookiepath` or `requirelogin`.

This would also be a good time to revisit the `localconfig` file and make sure that the names of the priorities, severities, platforms and operating systems are those you wish to use when you start creating bugs. Remember to rerun `checksetup.pl` if you change it.

Bugzilla has several optional features which require extra configuration. You can read about those in .

## Optional Additional Configuration

Bugzilla has a number of optional features. This section describes how to configure or enable them.

### Bug Graphs

If you have installed the necessary Perl modules you can start collecting statistics for the nifty Bugzilla graphs.

    bash# crontab -e

This should bring up the crontab file in your editor. Add a cron entry like this to run `collectstats.pl` daily at 5 after midnight:

    5 0 * * * cd <your-bugzilla-directory> ; ./collectstats.pl

After two days have passed you'll be able to view bug graphs from the Reports page.

When upgrading Bugzilla, this format may change. To create new status data, (re)move old data and run the following commands:

            bash$
            cd <your-bugzilla-directory>
            bash$
            ./collectstats.pl --regenerate

Windows does not have 'cron', but it does have the Task Scheduler, which performs the same duties. There are also third-party tools that can be used to implement cron, such as nncron.

### Dependency Charts

As well as the text-based dependency trees, Bugzilla also supports a graphical view of dependency relationships, using a package called 'dot'. Exactly how this works is controlled by the 'webdotbase' parameter, which can have one of three values:

1. A complete file path to the command 'dot' (part of GraphViz) will generate the graphs locally

2. A URL prefix pointing to an installation of the webdot package will generate the graphs remotely

3. A blank value will disable dependency graphing.

The easiest way to get this working is to install GraphViz. If you do that, you need to enable server-side image maps in Apache. Alternatively, you could set up a webdot server, or use the AT&T public webdot server. This is the default for the webdotbase param, but it's often overloaded and slow. Note that AT&T's server won't work if Bugzilla is only accessible using HARTS. Editor's note: What the heck is HARTS? Google doesn't know...

### The Whining Cron

What good are bugs if they're not annoying? To help make them more so you can set up Bugzilla's automatic whining system to complain at engineers which leave their bugs in the NEW or REOPENED state without triaging them.

This can be done by adding the following command as a daily crontab entry, in the same manner as explained above for bug graphs. This example runs it at 12.55am.

    55 0 * * * cd <your-bugzilla-directory> ; ./whineatnews.pl

Windows does not have 'cron', but it does have the Task Scheduler, which performs the same duties. There are also third-party tools that can be used to implement cron, such as nncron.

### Whining

As of Bugzilla 2.20, users can configure Bugzilla to regularly annoy them at regular intervals, by having Bugzilla execute saved searches at certain times and emailing the results to the user. This is known as "Whining". The process of configuring Whining is described in , but for it to work a Perl script must be executed at regular intervals.

This can be done by adding the following command as a daily crontab entry, in the same manner as explained above for bug graphs. This example runs it every 15 minutes.

    */15 * * * * cd <your-bugzilla-directory> ; ./whine.pl

Whines can be executed as often as every 15 minutes, so if you specify longer intervals between executions of whine.pl, some users may not be whined at as often as they would expect. Depending on the person, this can either be a very Good Thing or a very Bad Thing.

Windows does not have 'cron', but it does have the Task Scheduler, which performs the same duties. There are also third-party tools that can be used to implement cron, such as nncron.

### Patch Viewer

Patch Viewer is the engine behind Bugzilla's graphical display of code patches. You can integrate this with copies of the `cvs`, `lxr` and `bonsai` tools if you have them, by giving the locations of your installation of these tools in `editparams.cgi`.

Patch Viewer also optionally will use the `cvs`, `diff` and `interdiff` command-line utilities if they exist on the system. Interdiff can be obtained from . If these programs are not in the system path, you can configure their locations in `localconfig`.

### LDAP Authentication

LDAP authentication is a module for Bugzilla's plugin authentication architecture.

The existing authentication scheme for Bugzilla uses email addresses as the primary user ID, and a password to authenticate that user. All places within Bugzilla where you need to deal with user ID (e.g assigning a bug) use the email address. The LDAP authentication builds on top of this scheme, rather than replacing it. The initial log in is done with a username and password for the LDAP directory. This then fetches the email address from LDAP and authenticates seamlessly in the standard Bugzilla authentication scheme using this email address. If an account for this address already exists in your Bugzilla system, it will log in to that account. If no account for that email address exists, one is created at the time of login. (In this case, Bugzilla will attempt to use the "displayName" or "cn" attribute to determine the user's full name.) After authentication, all other user-related tasks are still handled by email address, not LDAP username. You still assign bugs by email address, query on users by email address, etc.

Because the Bugzilla account is not created until the first time a user logs in, a user who has not yet logged is unknown to Bugzilla. This means they cannot be used as an assignee or QA contact (default or otherwise), added to any cc list, or any other such operation. One possible workaround is the `bugzilla_ldapsync.rb` script in the `contrib` directory. Another possible solution is fixing bug 201069.

Parameters required to use LDAP Authentication:

loginmethod

  This parameter should be set to LDAP only if you will be using an LDAP directory for authentication. If you set this param to LDAP but fail to set up the other parameters listed below you will not be able to log back in to Bugzilla one you log out. If this happens to you, you will need to manually edit `data/params` and set loginmethod to DB.

LDAPserver

  This parameter should be set to the name (and optionally the port) of your LDAP server. If no port is specified, it assumes the default LDAP port of 389.

  Ex. ldap.company.com or ldap.company.com:3268

LDAPbinddn [Optional]

  Some LDAP servers will not allow an anonymous bind to search the directory. If this is the case with your configuration you should set the LDAPbinddn parameter to the user account Bugzilla should use instead of the anonymous bind.

  Ex. cn=default,cn=user:password

LDAPBaseDN

  The LDAPBaseDN parameter should be set to the location in your LDAP tree that you would like to search for email addresses. Your uids should be unique under the DN specified here.

  Ex. ou=People,o=Company

LDAPuidattribute

  The LDAPuidattribute parameter should be set to the attribute which contains the unique UID of your users. The value retrieved from this attribute will be used when attempting to bind as the user to confirm their password.

  Ex. uid

LDAPmailattribute

  The LDAPmailattribute parameter should be the name of the attribute which contains the email address your users will enter into the Bugzilla login boxes.

  Ex. mail

### Serving Alternate Formats with the right MIME type

Some Bugzilla pages have alternate formats, other than just plain HTML. In particular, a few Bugzilla pages can output their contents as either XUL (a special Mozilla format, that looks like a program GUI) or RDF (a type of structured XML that can be read by various programs).

In order for your users to see these pages correctly, Apache must send them with the right MIME type. To do this, add the following lines to your Apache configuration, either in the `<VirtualHost>` section for your Bugzilla, or in the `<Directory>` section for your Bugzilla:

    AddType application/vnd.mozilla.xul+xml .xul
    AddType application/rdf+xml .rdf

## OS-Specific Installation Notes

Many aspects of the Bugzilla installation can be affected by the operating system you choose to install it on. Sometimes it can be made easier and others more difficult. This section will attempt to help you understand both the difficulties of running on specific operating systems and the utilities available to make it easier.

If you have anything to add or notes for an operating system not covered, please file a bug in &bzg-bugs;.

### Microsoft Windows

Making Bugzilla work on Windows is more difficult than making it work on Unix. For that reason, we still recommend doing so on a Unix based system such as GNU/Linux. That said, if you do want to get Bugzilla running on Windows, you will need to make the following adjustments.

#### Win32 Perl

Perl for Windows can be obtained from ActiveState. You should be able to find a compiled binary at . The following instructions assume that you are using version 5.8.1 of ActiveState.

#### Perl Modules on Win32

Bugzilla on Windows requires the same perl modules found in . The main difference is that windows uses PPM instead of CPAN.

    C:\perl> ppm install <module name>

The best source for the Windows PPM modules needed for Bugzilla is probably the Bugzilla Test Server (aka 'Landfill'), so you should add the Landfill package repository as follows:

    ppm repository add landfill http://www.landfill.bugzilla.org/ppm/

The PPM repository stores modules in 'packages' that may have a slightly different name than the module. If retrieving these modules from there, you will need to pay attention to the information provided when you run `checksetup.pl` as it will tell you what package you'll need to install.

If you are behind a corporate firewall, you will need to let the ActiveState PPM utility know how to get through it to access the repositories by setting the HTTP_proxy system environmental variable. For more information on setting that variable, see the ActiveState documentation.

#### Code changes required to run on Win32

Bugzilla on Win32 is supported out of the box from version 2.20; this means that no code changes are required to get Bugzilla running.

#### Serving the web pages

As is the case on Unix based systems, any web server should be able to handle Bugzilla; however, the Bugzilla Team still recommends Apache whenever asked. No matter what web server you choose, be sure to pay attention to the security notes in . More information on configuring specific web servers can be found in .

If using Apache on windows, you can set the ScriptInterpreterSource directive in your Apache config to avoid having to modify the first line of every script to contain your path to perl perl instead of `/usr/bin/perl`.

#### Sending Email

To enable Bugzilla to send email on Windows, the server running the Bugzilla code must be able to connect to, or act as, an SMTP server.

### Mac OS X

Making Bugzilla work on Mac OS X requires the following adjustments.

#### Sendmail

In Mac OS X 10.3 and later, Postfix is used as the built-in email server. Postfix provides an executable that mimics sendmail enough to fool Bugzilla, as long as Bugzilla can find it.

As of version 2.20, Bugzilla will be able to find the fake sendmail executable without any assistance. However, you will have to turn on the sendmailnow parameter before you do anything that would result in email being sent. For more information, see the description of the sendmailnow parameter in .

#### Libraries & Perl Modules on Mac OS X

Apple did not include the GD library with Mac OS X. Bugzilla needs this for bug graphs.

You can install it using a program called Fink, which is similar in nature to the CPAN installer, but installs common GNU utilities. Fink is available from .

Follow the instructions for setting up Fink. Once it's installed, you'll want to use it to install the `gd2` package.

It will prompt you for a number of dependencies, type 'y' and hit enter to install all of the dependencies and then watch it work. You will then be able to use CPAN to install the GD Perl module.

To prevent creating conflicts with the software that Apple installs by default, Fink creates its own directory tree at `/sw` where it installs most of the software that it installs. This means your libraries and headers will be at `/sw/lib` and `/sw/include` instead of `/usr/lib` and `/usr/include`. When the Perl module config script asks where your `libgd` is, be sure to tell it `/sw/lib`.

Also available via Fink is `expat`. After using fink to install the expat package you will be able to install XML::Parser using CPAN. There is one caveat. Unlike recent versions of the GD module, XML::Parser doesn't prompt for the location of the required libraries. When using CPAN, you will need to use the following command sequence:

    # perl -MCPAN -e'look XML::Parser'
    # perl Makefile.PL EXPATLIBPATH=/sw/lib EXPATINCPATH=/sw/include
    # make; make test; make install
    # exit

The look command will download the module and spawn a new shell with the extracted files as the current working directory. The exit command will return you to your original shell.

You should watch the output from these make commands, especially make test as errors may prevent XML::Parser from functioning correctly with Bugzilla.

### Linux-Mandrake 8.0

Linux-Mandrake 8.0 includes every required and optional library for Bugzilla. The easiest way to install them is by using the `urpmi` utility. If you follow these commands, you should have everything you need for Bugzilla, and `./checksetup.pl` should not complain about any missing libraries. You may already have some of these installed.

    bash# urpmi perl-mysql
    bash# urpmi perl-chart
    bash# urpmi perl-gd
    bash# urpmi perl-MailTools
    bash# urpmi apache-modules

for Bugzilla email integration

## UNIX (non-root) Installation Notes

### Introduction

If you are running a *NIX OS as non-root, either due to lack of access (web hosts, for example) or for security reasons, this will detail how to install Bugzilla on such a setup. It is recommended that you read through the first to get an idea on the installation steps required. (These notes will reference to steps in that guide.)

### MySQL

You may have MySQL installed as root. If you're setting up an account with a web host, a MySQL account needs to be set up for you. From there, you can create the bugs account, or use the account given to you.

You may have problems trying to set up `GRANT` permissions to the database. If you're using a web host, chances are that you have a separate database which is already locked down (or one big database with limited/no access to the other areas), but you may want to ask your system administrator what the security settings are set to, and/or run the `GRANT` command for you.

Also, you will probably not be able to change the MySQL root user password (for obvious reasons), so skip that step.

#### Running MySQL as Non-Root

##### The Custom Configuration Method

Create a file .my.cnf in your home directory (using /home/foo in this example) as follows....

    [mysqld]
    datadir=/home/foo/mymysql
    socket=/home/foo/mymysql/thesock
    port=8081

    [mysql]
    socket=/home/foo/mymysql/thesock
    port=8081

    [mysql.server]
    user=mysql
    basedir=/var/lib

    [safe_mysqld]
    err-log=/home/foo/mymysql/the.log
    pid-file=/home/foo/mymysql/the.pid

##### The Custom Built Method

You can install MySQL as a not-root, if you really need to. Build it with PREFIX set to `/home/foo/mysql`, or use pre-installed executables, specifying that you want to put all of the data files in `/home/foo/mysql/data`. If there is another MySQL server running on the system that you do not own, use the -P option to specify a TCP port that is not in use.

##### Starting the Server

After your mysqld program is built and any .my.cnf file is in place, you must initialize the databases (ONCE).

                  bash$
                  mysql_install_db

Then start the daemon with

                  bash$
                  safe_mysql &

After you start mysqld the first time, you then connect to it as "root" and `GRANT` permissions to other users. (Again, the MySQL root account has nothing to do with the *NIX root account.)

You will need to start the daemons yourself. You can either ask your system administrator to add them to system startup files, or add a crontab entry that runs a script to check on these daemons and restart them if needed.

Do NOT run daemons or other services on a server without first consulting your system administrator! Daemons use up system resources and running one may be in violation of your terms of service for any machine on which you are a user!

### Perl

On the extremely rare chance that you don't have Perl on the machine, you will have to build the sources yourself. The following commands should get your system installed with your own personal version of Perl:

            bash$
            wget http://perl.com/CPAN/src/stable.tar.gz
            bash$
            tar zvxf stable.tar.gz
            bash$
            cd perl-5.8.1 (or whatever the version of Perl is called)
            bash$
            sh Configure -de -Dprefix=/home/foo/perl
            bash$
            make && make test && make install

Once you have Perl installed into a directory (probably in `~/perl/bin`), you'll have to change the locations on the scripts, which is detailed later on this page.

### Perl Modules

Installing the Perl modules as a non-root user is probably the hardest part of the process. There are two different methods: a completely independant Perl with its own modules, or personal modules using the current (root installed) version of Perl. The independant method takes up quite a bit of disk space, but is less complex, while the mixed method only uses as much space as the modules themselves, but takes more work to setup.

#### The Independant Method

The independant method requires that you install your own personal version of Perl, as detailed in the previous section. Once installed, you can start the CPAN shell with the following command:

                bash$
                /home/foo/perl/bin/perl -MCPAN -e 'shell'

And then:

                cpan>
                install Bundle::Bugzilla

With this method, module installation will usually go a lot smoother, but if you have any hang-ups, you can consult the next section.

#### The Mixed Method

First, you'll need to configure CPAN to install modules in your home directory. The CPAN FAQ says the following on this issue:

    5)  I am not root, how can I install a module in a personal directory?

        You will most probably like something like this:

          o conf makepl_arg "LIB=~/myperl/lib \
                             INSTALLMAN1DIR=~/myperl/man/man1 \
                             INSTALLMAN3DIR=~/myperl/man/man3"
        install Sybase::Sybperl

        You can make this setting permanent like all "o conf" settings with "o conf commit".

        You will have to add ~/myperl/man to the MANPATH environment variable and also tell your Perl programs to
        look into ~/myperl/lib, e.g. by including

          use lib "$ENV{HOME}/myperl/lib";

        or setting the PERL5LIB environment variable.

        Another thing you should bear in mind is that the UNINST parameter should never be set if you are not root.

So, you will need to create a Perl directory in your home directory, as well as the `lib`, `man`, `man/man1`, and `man/man3` directories in that Perl directory. Set the MANPATH variable and PERL5LIB variable, so that the installation of the modules goes smoother. (Setting UNINST=0 in your "make install" options, on the CPAN first-time configuration, is also a good idea.)

After that, go into the CPAN shell:

                bash$
                perl -MCPAN -e 'shell'

From there, you will need to type in the above "o conf" command and commit the changes. Then you can run through the installation:

                cpan>
                install Bundle::Bugzilla

Most of the module installation process should go smoothly. However, you may have some problems with Template. When you first start, you will want to try to install Template with the XS Stash options on. If this doesn't work, it may spit out C compiler error messages and croak back to the CPAN shell prompt. So, redo the install, and turn it off. (In fact, say no to all of the Template questions.) It may also start failing on a few of the tests. If the total tests passed is a reasonable figure (90+%), force the install with the following command:

                cpan>
                force install Template

You may also want to install the other optional modules:

              cpan>
              install GD
              cpan>
              install Chart::Base
              cpan>
              install MIME::Parser

### HTTP Server

Ideally, this also needs to be installed as root and run under a special webserver account. As long as the web server will allow the running of *.cgi files outside of a cgi-bin, and a way of denying web access to certain files (such as a .htaccess file), you should be good in this department.

#### Running Apache as Non-Root

You can run Apache as a non-root user, but the port will need to be set to one above 1024. If you type `httpd -V`, you will get a list of the variables that your system copy of httpd uses. One of those, namely HTTPD_ROOT, tells you where that installation looks for its config information.

From there, you can copy the config files to your own home directory to start editing. When you edit those and then use the -d option to override the HTTPD_ROOT compiled into the web server, you get control of your own customized web server.

You will need to start the daemons yourself. You can either ask your system administrator to add them to system startup files, or add a crontab entry that runs a script to check on these daemons and restart them if needed.

Do NOT run daemons or other services on a server without first consulting your system administrator! Daemons use up system resources and running one may be in violation of your terms of service for any machine on which you are a user!

### Bugzilla

If you had to install Perl modules as a non-root user () or to non-standard directories, you will need to change the scripts, setting the correct location of the Perl modules:

    perl -pi -e
            's@use strict\;@use strict\; use lib \"/home/foo/perl/lib\"\;@'
            *cgi *pl Bug.pm processmail syncshadowdb

Change `/home/foo/perl/lib` to your personal Perl library directory. You can probably skip this step if you are using the independant method of Perl module installation.

When you run `./checksetup.pl` to create the `localconfig` file, it will list the Perl modules it finds. If one is missing, go back and double-check the module installation from the CPAN shell, then delete the `localconfig` file and try again.

The one option in `localconfig` you might have problems with is the web server group. If you can't successfully browse to the `index.cgi` (like a Forbidden error), you may have to relax your permissions, and blank out the web server group. Of course, this may pose as a security risk. Having a properly jailed shell and/or limited access to shell accounts may lessen the security risk, but use at your own risk.