View Full Version : Installing Bugzilla on a WestHost VPS

03-28-2006, 11:43 PM
I was able to get Bugzilla v2.20.1 installed and running on my WestHost VPS (after three days of trying).
While it is still fresh in my mind I am going to try and document the steps here. I won't guarantee these however, because I tried a lot of different things before I finally succeeded.
That included uninstalling my WestHost Perl 5.8.7, installing Perl 5.6 plus Mod Perl 1.2.6 then uninstalling that and returning to Perl 5.8.7.

To start, get the Bugzilla release from http://www.bugzilla.org/
I got version 2.20.1 as it is the current stable release. The installation comes with a PDF document named Bugzilla-Guide.pdf. It has pretty good instructions and a lot of information. Some steps in my installation ordeal probably would have been easier if I had read all of the fine print.
The guide covers everything necessary to support Bugzilla so some things you can already have out of the way using the WestHost provided site applications.
Those are MySql, Perl and Apache. Here are the versions my VPS has now with Bugzilla running -
Apache/1.3.27 (Unix)(Red-Hat/Linux)
Perl (revision 5 version 8 subversion 7)
MySql Ver 14.7 Distrib 4.1.9, for pc-linux-gnu (i686)

Assuming you have those applications in place the first step is to unpack the Bugzilla tar ball and put it somewhere.
For my installation I put the Bugzilla folders and files from the tar file in a directory named "bugzilla" right under my website root directory.
So on WestHost that is /var/www/html/bugzilla The Bugzilla instructions list some other installation location options but the route I chose is the easiest I think.

Bugzilla comes with easy to run configuration scripts. There really is just one main one to start.
It is checksetup.pl. Initially you run it like this ./checksetup.pl --check-modules from your shell at your Bugzilla installation directory.
The output from that script will tell you what Perl modules you need to update and/or install. NOTE: I couldn't get the GD (1.20) and Chart:Base (1.0) modules to install. Those didn't matter though as they are optional.

The next steps involve installing necessary Perl modules that are required by Bugzilla. The Perl module installation was pretty smooth. There is a how-to set of instructions on the WestHost forum that shows how to use CPAN to install additional Perl modules in your VPS.
To summarize the important steps - Bugzilla needs some Perl modules that the WestHost Perl installation doesn't include. If your WestHost VPS is like mine then root owns the Perl installation and libraries.
That means that you can't install additional modules or updated existing modules where your Perl is installed. Perl accounts for that and you only have to create your own Perl module directory. Using the new directory you use CPAN to download, build and install Perl modules.
After that you need to let your VPS know where the new Perl modules are so Perl scripts can use them. That is where your define the PERL5LIB environment variable for your shell.
All of the Perl module installation issues are covered by the instructions in this forum here: http://forums.westhost.com/showthread.php?t=6859&highlight=perl+cpan

Once the ./checksetup.pl --check-modules tests show that all required Perl modules are present you are about ready to run just ./checksetup.pl
Now the script will generate a new file in your Bugzilla home directory called "localconfig". You will be prompted for some of the entries while others you will probably have to use and editor like vi to modify the file.
The ./checksetup.pl will also setup the necessary MySql database tables. Before it could do that I went into MySql using the WestHost PHP MySql administration application.
I created the bugs database and a user called bugs with the permissions listed in the Bugzilla-Guide.pdf.

Once the database is initialized by checksetup.pl the script will prompt for a Bugzilla administrator login, name and password. Make sure you write these down. If you forget them you can blast the records from the MySql bugs database and the script will prompt you again.
The checksetup.pl script will also ask you to enter a webservergroup. On WestHost our group is usually "vuser". My setup didn't like that. Bugzilla-Guide instructions mention that in a case where the installation is on a VPS where you don't have root access, you can leave the webservergroup setting blank (""). That is what I did.

The install process is essentially to keep running ./checksetup.pl until it says everything required is okay.
You will have to add a few entries to your Apache httpd.conf file though. The Bugzilla-Guide describes part of that.
An entry for Bugzilla to be able to run CGI scripts is one entry. Mine looks like this -
# Bugzilla access
<Directory /var/www/html/bugzilla>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit

Be sure and bounce the Apache server after modifying the httpd.conf file.

With the ./checksetup.pl script now flagging all necessary checks as okay you are ready to see if you can access your Bugzilla site.
There is a test script that you run from the shell for that as well -
./testserver.pl http://www.mywebsite.com/bugzilla

My output from that script (once my installation was successful) looks like this -
TEST-WARNING Failed to find the GID for the 'httpd' process, unable
to validate webservergroup.
TEST-OK Got ant picture.
TEST-OK Webserver is executing CGIs.
TEST-OK Webserver is preventing fetch of http://www.mywebsite.com/bugzilla/localconfig.

According to the Bugzilla-Guide documentation I can just ignore the TEST-WARNING message about the webservergroup entry.

Now you should theoretically be able to hit http://www.yourwebsite.com/bugzilla from a browser. This is where I had the biggest problem.
On my first try I got a 500 error and the Apache log had an error message like this -

Can't locate Date/Format.pm in @INC (@INC contains: . /usr/local/perl/lib/5.8.7/i686-linux /usr/local/perl/lib/5.8.7 /usr/local/perl/lib/site_perl/5.8.7/i686-linux /usr/local/perl/lib/site_perl/5.8.7 /usr/local/perl/lib/site_perl) at Bugzilla/Error.pm line 32.
BEGIN failed--compilation aborted at Bugzilla/Error.pm line 32.
Compilation failed in require at Bugzilla/Util.pm line 45.
BEGIN failed--compilation aborted at Bugzilla/Util.pm line 45.
Compilation failed in require at CGI.pl line 43.
BEGIN failed--compilation aborted at CGI.pl line 43.
Compilation failed in require at /var/www/html/bugzilla/index.cgi line 33.
[error] [client] Premature end of script headers: /var/www/html/bugzilla/index.cgi

The Apache environment didn't know about the added Perl modules the shell knew about as defined in PERL5LIB.
To fix that I tried a hundred different things (including changing my Perl version). Now that it finally works I believe you need another entry in your Apache httpd.conf file like this -
SetEnv PERL5LIB /usr/local/perl5add/lib

/usr/local/perl5add is where I put my additional Perl modules but that can really be anywhere you want (within reason).
I put that entry in my httpd.conf right after the user and group settings. I can't tell you whether the location in the file matters.
Be sure and restart Apache again.

Because I had so many problems and was trying so many different things I can't say for sure that entry alone fixed my problems. I could swear that was one of my early failed attempts.
If that doesn't do the trick then there is this bit of information in the Bugzilla-Guide.pdf in Chapter 2.5 Unix (nonroot) Installation Notes in the section - 2.5.6 Bugzilla.
The guide says -
If you had to install Perl modules as a non-root user (Section 2.5.4) or to non-standard directories, you will need to
change the scripts, setting the correct location of the Perl modules and provides this Perl snippet of code to run in the shell in your Bugzilla home directory.

perl -li -e 's@use strict\;@use strict\; use lib \"/usr/local/perl5add/lib\"\;@' *cgi *pl Bug.pm processmail syncshadowdb

When I ran this I couldn't tell if it actually did anything. At this point in my installation experience (I was on my third day) I was very close to giving up and wasn't very observant of anything specific that fixed my errors.
It was after the SetEnv in httpd.conf was working that Bugzilla started working. Here is a little test CGI file you can put in your Bugzilla home to try and access from a browser to test your Perl environment.

print "Content-type: text/plain\r\n\r\n";
print "Server's environment\n";
foreach ( keys %ENV ) {
print "$_\t$ENV{$_}\n";

print "Perl environment\n";
foreach $INC (@INC) {
print "$INC \n";
print "Test Complete\n";

The Perl environment should look something like this -
Perl environment
Test Complete

That is it. Now you can login as administrator. Be sure and visit the http://www.yourwebsite.com/bugzilla/editparams.cgi page to initialize Bugzilla web parameters.