Keywords: Bugzilla, Guide, installation, FAQ, administration, integration, MySQL, Mozilla, webtools

2.7. Upgrading to New Releases
Prev | Chapter 2. Installing Bugzilla | Next

## 2.7. Upgrading to New Releases

Upgrading to new Bugzilla releases is very simple. There is a script named `checksetup.pl` included with Bugzilla that will automatically do all of the database migration for you.

The following sections explain how to upgrade from one version of Bugzilla to another. Whether you are upgrading from one bug-fix version to another (such as 4.2 to 4.2.1) or from one major version to another (such as from 4.0 to 4.2), the instructions are always the same.

Any examples in the following sections are written as though the user were updating to version 4.2.1, but the procedures are the same no matter what version you're updating to. Also, in the examples, the user's Bugzilla installation is found at `/usr/local/www/bugzilla`. If that is not the same as the location of your Bugzilla installation, simply substitute the proper paths where appropriate.

### 2.7.1. Before You Upgrade

Before you start your upgrade, there are a few important steps to take:

1. Read the Release Notes of the version you're upgrading to, particularly the "Notes for Upgraders" section.

2. View the Sanity Check (Section 3.16, “Checking and Maintaining Database Integrity”) page on your installation before upgrading. Attempt to fix all warnings that the page produces before you go any further, or you may experience problems during your upgrade.

3. Shut down your Bugzilla installation by putting some HTML or text in the shutdownhtml parameter (see Section 3.1, “Bugzilla Configuration”).

4. Make a backup of the Bugzilla database. THIS IS VERY IMPORTANT. If anything goes wrong during the upgrade, your installation can be corrupted beyond recovery. Having a backup keeps you safe.

   Upgrading is a one-way process. You cannot "downgrade" an upgraded Bugzilla. If you wish to revert to the old Bugzilla version for any reason, you will have to restore your database from this backup.

   Here are some sample commands you could use to backup your database, depending on what database system you're using. You may have to modify these commands for your particular setup.

   MySQL:

     mysqldump --opt -u bugs -p bugs > bugs.sql

   PostgreSQL:

     pg_dump --no-privileges --no-owner -h localhost -U bugs > bugs.sql

### 2.7.2. Getting The New Bugzilla

There are three ways to get the new version of Bugzilla. We'll list them here briefly and then explain them more later.

Bzr (Section 2.7.2.2, “Upgrading using Bzr”)

  If you have bzr installed on your machine and you have Internet access, this is the easiest way to upgrade, particularly if you have made modifications to the code or templates of Bugzilla.

Download the tarball (Section 2.7.2.3, “Upgrading using the tarball”)

  This is a very simple way to upgrade, and good if you haven't made many (or any) modifications to the code or templates of your Bugzilla.

Patches (Section 2.7.2.4, “Upgrading using patches”)

  If you have made modifications to your Bugzilla, and you don't have Internet access or you don't want to use bzr, then this is the best way to upgrade.

  You can only do minor upgrades (such as 4.2 to 4.2.1 or 4.2.1 to 4.2.2) with patches.

#### 2.7.2.1. If you have modified your Bugzilla

If you have modified the code or templates of your Bugzilla, then upgrading requires a bit more thought and effort. A discussion of the various methods of updating compared with degree and methods of local customization can be found in Section 6.3.2, “Choosing a Customization Method”.

The larger the jump you are trying to make, the more difficult it is going to be to upgrade if you have made local customizations. Upgrading from 4.2 to 4.2.1 should be fairly painless even if you are heavily customized, but going from 2.18 to 4.2 is going to mean a fair bit of work re-writing your local changes to use the new files, logic, templates, etc. If you have done no local changes at all, however, then upgrading should be approximately the same amount of work regardless of how long it has been since your version was released.

#### 2.7.2.2. Upgrading using Bzr

This requires that you have bzr installed (most Unix machines do), and requires that you are able to access bzr.mozilla.org, which may not be an option if you don't have Internet access.

The following shows the sequence of commands needed to update a Bugzilla installation via Bzr, and a typical series of results. These commands assume that you already have Bugzilla installed using Bzr.

If your installation is still using CVS, you must first convert it to Bzr. A very detailed step by step documentation can be found on wiki.mozilla.org.

    bash$ cd /usr/local/www/bugzilla
    bash$ bzr switch 4.2 (only run this command when not yet running 4.2)
    bash$ bzr up -r tag:bugzilla-4.2.1
    +N  extensions/MoreBugUrl/
    +N  extensions/MoreBugUrl/Config.pm
    +N  extensions/MoreBugUrl/Extension.pm
    ...
     M  Bugzilla/Attachment.pm
     M  Bugzilla/Attachment/PatchReader.pm
     M  Bugzilla/Bug.pm
    ...
    All changes applied successfully.

If a line in the output from bzr up mentions a conflict, then that represents a file with local changes that Bzr was unable to properly merge. You need to resolve these conflicts manually before Bugzilla (or at least the portion using that file) will be usable.

#### 2.7.2.3. Upgrading using the tarball

If you are unable (or unwilling) to use Bzr, another option that's always available is to obtain the latest tarball from the Download Page and create a new Bugzilla installation from that.

This sequence of commands shows how to get the tarball from the command-line; it is also possible to download it from the site directly in a web browser. If you go that route, save the file to the `/var/www/html` directory (or its equivalent, if you use something else) and omit the first three lines of the example.

    bash$ cd /var/www/html
    bash$ wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.2.1.tar.gz
    (Output omitted)
    bash$ tar xzvf bugzilla-4.2.1.tar.gz
    bugzilla-4.2.1/
    bugzilla-4.2.1/colchange.cgi
    (Output truncated)
    bash$ cd bugzilla-4.2.1
    bash$ cp ../bugzilla/localconfig* .
    bash$ cp -r ../bugzilla/data .
    bash$ cd ..
    bash$ mv bugzilla bugzilla.old
    bash$ mv bugzilla-4.2.1 bugzilla

The cp commands both end with periods which is a very important detail--it means that the destination directory is the current working directory.

If you have some extensions installed, you will have to copy them to the new bugzilla directory too. Extensions are located in `bugzilla/extensions/`. Only copy those you installed, not those managed by the Bugzilla team.

This upgrade method will give you a clean install of Bugzilla. That's fine if you don't have any local customizations that you want to maintain. If you do have customizations, then you will need to reapply them by hand to the appropriate files.

#### 2.7.2.4. Upgrading using patches

A patch is a collection of all the bug fixes that have been made since the last bug-fix release.

If you are doing a bug-fix upgrade—that is, one where only the last number of the revision changes, such as from 4.2 to 4.2.1—then you have the option of obtaining and applying a patch file from the Download Page.

As above, this example starts with obtaining the file via the command line. If you have already downloaded it, you can omit the first two commands.

    bash$ cd /usr/local/www/bugzilla
    bash$ wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.2-to-4.2.1.diff.gz
    (Output omitted)
    bash$ gunzip bugzilla-4.2-to-4.2.1.diff.gz
    bash$ patch -p1 < bugzilla-4.2-to-4.2.1.diff
    patching file Bugzilla/Constants.pm
    patching file enter_bug.cgi
    (etc.)

Be aware that upgrading from a patch file does not change the entries in your `.bzr` directory. This could make it more difficult to upgrade using Bzr (Section 2.7.2.2, “Upgrading using Bzr”) in the future.

### 2.7.3. Completing Your Upgrade

Now that you have the new Bugzilla code, there are a few final steps to complete your upgrade.

1. If your new Bugzilla installation is in a different directory or on a different machine than your old Bugzilla installation, make sure that you have copied the `data` directory and the `localconfig` file from your old Bugzilla installation. (If you followed the tarball instructions above, this has already happened.)

2. If this is a major update, check that the configuration (Section 2.2, “Configuration”) for your new Bugzilla is up-to-date. Sometimes the configuration requirements change between major versions.

3. If you didn't do it as part of the above configuration step, now you need to run checksetup.pl, which will do everything required to convert your existing database and settings for the new version:

       bash$ cd /usr/local/www/bugzilla
       bash$ ./checksetup.pl

   The period at the beginning of the command ./checksetup.pl is important and cannot be omitted.

   If this is a major upgrade (say, 3.6 to 4.2 or similar), running checksetup.pl on a large installation (75,000 or more bugs) can take a long time, possibly several hours.

4. Clear any HTML or text that you put into the shutdownhtml parameter, to re-activate Bugzilla.

5. View the Sanity Check (Section 3.16, “Checking and Maintaining Database Integrity”) page in your upgraded Bugzilla.

   It is recommended that, if possible, you fix any problems you see, immediately. Failure to do this may mean that Bugzilla will not work correctly. Be aware that if the sanity check page contains more errors after an upgrade, it doesn't necessarily mean there are more errors in your database than there were before, as additional tests are added to the sanity check over time, and it is possible that those errors weren't being checked for in the old version.

### 2.7.4. Automatic Notifications of New Releases

Bugzilla 3.0 introduced the ability to automatically notify administrators when new releases are available, based on the `upgrade_notification` parameter, see Section 3.1, “Bugzilla Configuration”. Administrators will see these notifications when they access the `index.cgi` page, i.e. generally when logging in. Bugzilla will check once per day for new releases, unless the parameter is set to “disabled”. If you are behind a proxy, you may have to set the `proxy_url` parameter accordingly. If the proxy requires authentication, use the `http://user:pass@proxy_url/` syntax.

Prev | Up | Next
2.6. UNIX (non-root) Installation Notes | Home | Chapter 3. Administering Bugzilla