Installing Bugzilla and Bugzilla API on Ubuntu

Document ID : KB000057560
Last Modified Date : 14/02/2018
Show Technical Document Details

Issue

How can I install Bugzilla and the Bugzilla API?

Resolution

Installing Bugzilla
Here are the main steps (all performed logged in as root):
??1. Install Perl(5.8.1 or above)
??2. Install MySQL
??3. Install Apache2
??4. Install Bugzilla
??5. Install Perl modules
??6. Bugzilla using apache

1. Perl
Verify if Perl is installed


If not in installed:

apt-get install perl

2. MySQL
Verify if MySQL is installed

mysql --version


If not installed:

apt-get install mysql-client mysql-server mysql-admin


The MySQL installer will ask you to create a password for the root MySQL user.





We want MySQL to listen on all interfaces, not just localhost, so edit /etc/mysql/my.cnf and comment out the line bind-address = 127.0.0.1, then restart MySQL:


Restart MySQL
$ /etc/init.d/mysql restart


Check MySQL configuration:


Create a database ?bugzilla? and grant privileges to ?bugzilla? database to ?bugzilla? user:


Add a bugzilla user to the system: ?(passwd will allow you to set a password for user bugzilla - in the examples below, bugzilla's password is ?ThisMachine?)
$ useradd -d /home/bugzilla -m bugzilla
$ passwd bugzilla


3. Apache2
Verify if Apache is installed:

apache2 ?v????

You can also view in a web browser the default welcome page at http://localhost

If not installed:

apt-get install apache2


?
4. Bugzilla
Download Bugzilla from http://www.bugzilla.org/download/.

Untar the downloaded file to your download folder

tar -xvf bugzilla-3.6.2.tar


Move bugzilla directory to /usr/local/


Make a symbolic link from /usr/local/bugzilla-3.6.2 to ?/var/www/bugzilla

ln -s /usr/local/bugzilla3.x /var/www/bugzilla


5. 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.

  • Verify if Perl modules are installed

cd /usr/local/bugzilla-3.6.2
./checksetup.pl --check-modules
?
checksetup will tell you if any required modules are not installed.


To install them, use perl -MCPAN -e "install modulename", e.g.

perl -MCPAN -e "install SOAP::Lite"

You may also need to install the make utility to get the perl module installs to succeed:

???apt-get install make

Run checksetup.pl without the --check-modules flag ?to create localconfig
?
Edit localconfig file in /usr/local/bugzilla-3.6.2


?Edit the ?localconfig? file in /usr/local/bugzilla-3.4.6: ?(you may want to also read http://www.bugzilla.org/docs/3.6.4/en/html/configuration.html)

  • Change the $db_pass value to the password for the ?bugzilla? user you created for the ?bugzilla? database using the MySQL grant statement. ?
  • Make sure the $db_name variable is set to the name of the database you created in MySQL above.


?

  • Make sure $webservergroup is set to the group your web server runs under. ?In the case of Apache on Ubuntu/Debian, it's 'www-data'. ?On other Linuxes it may be 'apache'.

  • Run the checksetup.pl again, this time without the --check-modules flag

$ ./checksetup.pl

checksetup.pl connects to the database using the 'bugzilla' user you created and the password you defined, and creates the 'bugs' database and the tables therein.
After that, checksetup 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.


?
6. Configure Apache2 for Bugzilla

  • Add the following directives to /etc/apache2/apache2.conf

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

?

  • Restart apache

/etc/init.d/apache2 restart


You should have a testserver.pl script:

  • Run Bugzilla's testserver script:

./testserver.pl http://localhost/bugzilla

?
You should see some success messages like:
TEST-OK Webserver is running under group id in $webservergroup.
TEST-OK Got padlock picture.
TEST-OK Webserver is executing CGIs via mod_cgi.
Restart Apache server


7. Check the Installation
Point your browser to http://localhost/bugzilla.
You should see the login page.

8. Configure Bugzilla
Login as admin and click on the Administration link to get to
http://localhost/bugzilla/admin.cgi
Click on the Required Settings link in the navbar on the left, then on the parameters link to get to http://localhost/bugzilla/editparams.cgi and set urlbase to http://localhost/bugzilla/. You should check all the other required settings and fill any in that make sense.


Installing Bugzilla API

1. Install Bugzilla patches
You can save the patch from a browser and copy it to the bugzilla server, or use wget. ?To install:
$ cd /usr/local/bugzilla-3.4.6
$ patch -bp 0 -i <patch file name>

$ cd /usr/local/bugzilla-3.6.2/template/en/default
$ cp config.json.tmpl config.json.tmpl.orig
$ cp updated_config.json.tmpl /usr/local/bugzilla-3.6.2


Where updated_config.json.tmpl is the file you downloaded from the bug report. Make sure config.json.tmpl has the appropriate permissions.
Visit http://localhost/bugzilla to make sure Bugzilla still functions normally.


2. Install the Bugzilla API Server

  • Install whatever Perl modules are necessary for the XML-RPC API to work. This includes at least SOAP::Lite. ?[Make sure SOAP::Lite was installed]

?

  • Install Catalyst libraries (Catalyst is an MVC web framework for Perl) and Mercurial

apt-get install libcatalyst-perl libcatalyst-modules-perl libmoose-perl libapache2-mod-fastcgi liblog-handler-perl
apt-get install mercurial

  • Install build system dependencies (needed by additional Perl modules):

?
sudo apt-get install expat
sudo apt-get install libexpat1
sudo apt-get install libexpat1-dev
?

  • Install Perl modules

perl -MCPAN -e "install Array::Diff"
perl -MCPAN -e "install Slurp"
perl -MCPAN -e "install Moose"
perl -MCPAN -e "install Test::More"
perl -MCPAN -e "install Data::Walk"
perl -MCPAN -e "install Catalyst::Controller::REST" (inc. optional modules)
perl -MCPAN -e "install Catalyst::Plugin::Log::Handler"
perl -MCPAN -e "install Catalyst::Plugin::Static::Simple"
perl -MCPAN -e "install Catalyst::Plugin::ConfigLoader"
perl -MCPAN -e "install Catalyst::Action"
perl -MCPAN -e "install Config::General"
perl -MCPAN -e "install Text:CSV_XS"
perl -MCPAN -e "install XML::Simple"
perl -MCPAN -e "install XML::Parser"
perl -MCPAN -e "install DateTime::Format::ISO8601"
perl -MCPAN -e "install BOBTFISH/Catalyst-Action-RenderView-0.16.tar.gz"
perl -MCPAN -e "install BZ::Client"
?
You may receive a couple of errors like this one ?

but they should not prevent install from completing. Reply ?yes? to the prompts and continue.

  • Check out the API source code from Mercurial

cd /var/www
hg clone http://hg.mozilla.org/webtools/bzapi 0.7

?

  • In var/www/0.7 copy bugzilla_api.conf.sample to bugzilla_api.conf and edit the appropriate parameters to tell the API about your Bugzilla:

?
cd var/www/0.7
?
bugzilla_url
bugzilla_time zone
log_bzclient (recommended)
log_xmlrpc 1 (if you wish)
?
Also, change the bugzilla version if appropriate.

  • Start the test server to check all required Perl modules are installed

script/bugzilla_api_server.pl

  • Enable the SSL mod for Apache:

a2enmod ssl
?

  • Create virtual hosts for the Bugzilla API server.

Install FastCGI module for apache2:
?
sudo apt-get install libapache2-mod-fastcgi
?
In /etc/apache2/sites-available,
cp default bzapi
Edit this config file bzapi and add these lines before the closing </VirtualHost> tag:
FastCgiServer /var/www/0.7/script/bugzilla_api_fastcgi.pl -processes 3 -idle-timeout 180

Alias /0.7 /var/www/0.7/script/bugzilla_api_fastcgi.pl/


Copy default-ssl to bzapi-ssl

cp default-ssl bzapi-ssl

Then edit bzapi-ssl and add this line right before the closing </VirtualHost> ?tag:

Alias /0.7 /var/www/0.7/script/bugzilla_api_fastcgi.pl/

  • If you have a certificate you will need to edit bzapi-ssl to point to it. Otherwise generate one using:

make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /root/snake-oil.crt
and change the SSLCertificate line in bzapi-ssl to point to /root/snake-oil.crt
You can also comment out SSLCertificateKeyFile

  • Restart apache:

apache2ctl restart

  • Restart test server:

cd /var/www/0.7

script/bugzilla_api_server.pl


Wait for the script to run


UPDATING TO BUGZILLA API 0.9



Create virtual hosts for the Bugzilla API server. In /etc/apache2/sites-available,


Then edit bzapi and add these lines right before the closing </VirtualHost> tag:

FastCgiServer /var/www/0.9/script/bugzilla_api_fastcgi.pl -processes 3 -idle-timeout 180

Alias /0.9 /var/www/0.9/script/bugzilla_api_fastcgi.pl/


Edit bzapi-ssl and add this line right before the closing </VirtualHost> tag:

Alias /0.9 /var/www/0.9/script/bugzilla_api_fastcgi.pl/

?


If you have a certificate you will need to edit bzapi-ssl to point to it. Otherwise generate one using

make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /root/snake-oil.crt

Change the SSLCertificateFile line in bzapi-ssl to point to /root/snake-oil.crt. You can also comment out SSLCertificateKeyFile?


???????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????
?????????
??????????????????????????????????????????????????????????????????????????????????? ??????????
????????????
???????????
???????????? ?????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????
?????????



????????????


Copy the Bugzilla API extensions directory into the Bugzilla install directory:
?
Per the directions in this article:
?
https://wiki.mozilla.org/Bugzilla:REST_API#Extension_.28or_Patches.29
?
Even the latest stable release of Bugzilla requires a little modification to work properly with the BzAPI. Unfortunately, it is not possible to support all the necessary functionality without some changes to Bugzilla itself, which the Bugzilla team have declined to take.
So for Bugzilla 3.6 and above, there is a Bugzilla Extension which adds the necessary functionality. Find it in $BZAPI_HOME/extension; copy the BzAPI directory from there into $BUGZILLA_HOME/extensions.
cp /var/www/0.7/extension/BzAPI /usr/local/bugzilla-3.6/extensions
Errors when copying Defects from CA Agile Central -> Bugzilla Bugs
?
When running the connector, if there are problems copying Defects from CA Agile Central to Bugzilla, you may see the following signatures in the log files:
?
/var/log/apache2/error.log:
?
[Wed Aug 21 10:35:26 2013] [error] [client 127.0.0.1] [Wed Aug 21 10:35:26 2013] xmlrpc.cgi: BEGIN failed--compilation aborted at /var/www/bugzilla-4.0.10/xmlrpc.cgi line 30.
?
/tmp/bzapi.log:
?
Aug 21 10:24:23 [INFO] BZ::Client::_api_call, sending request for method Bug.create to http://supp-vmubuntu64/bugzilla-4.0.10/
Aug 21 10:24:23 [ERROR] $VAR1 = {
?????????'error' => 1,
?????????'code' => undef,
?????????'message' => 'Unknown error: 500 Internal Server Error'
???????};
Aug 21 10:24:23 [INFO]
?
According to this article:
?
http://mozilla.6506.n7.nabble.com/The-XML-RPC-Interface-feature-is-not-available-in-this-Bugzilla-Need-help-td261275.html
?
This can be a symptom of conflicts between the version of SOAP::Lite installed by CPAN versus the system package manager (apt, for Ubuntu).
?
I was able to resolve this problem by re-installing SOAP::Lite using:
?
sudo apt-get install libsoap-lite-perl