适用于 Linux 的分步 Bugzilla 安装指南

举报
Tiamo_T 发表于 2022/02/13 10:52:57 2022/02/13
【摘要】 Bugzilla 是最好的开源错误跟踪系统。使用非常简单,具有许多功能。Bugzilla 允许您跟踪错误并有效地与组织中的开发人员和其他团队协作。 这是针对 Linux的详细的逐步bugzilla 安装指南

Bugzilla 是最好的开源错误跟踪系统。使用非常简单,具有许多功能。Bugzilla 允许您跟踪错误并有效地与组织中的开发人员和其他团队协作。

这是针对 Linux的详细的逐步bugzilla 安装指南。

1. 验证 Perl 版本

确保您的 perl 版本 >= 5.8.1,如下所示。

# perl -v

This is perl, v5.8.8 built for i386-linux-thread-multi

大多数 Linux 发行版都带有 perl。如果您没有它,请从相应的分发网站下载并安装它。

2.安装MySQL数据库

确保您的 MySQL 版本 >= 4.1.2,如下所示。

# mysql -V
mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (i686) using readline 5.1

如果您没有 mysql,请使用yum groupinstall安装它

3.安装阿帕奇

如果您已经安装了 apache,请确保您可以使用 http://{your-ip-address} 访问它。

如果您没有 apache,安装使用基于LAMP 安装文章的 yum,或者从 source 安装 apache

4. 下载最新的 Bugzilla tar 球

从bugzilla 下载页面下载最新的稳定版本。将bugzilla*.tar.gz文件解压到apache文档根目录下,如下图。

# cd ~

# wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-3.6.tar.gz

# cd /var/www/html

# tar xvfz /usr/save/bugzilla-3.4.6.tar.gz

5. 执行 bugzilla checksetup.pl

Bugzilla checksetup.pl 程序将验证是否安装了所有必需的 perl 模块。这还将显示需要安装的所有缺少的 bugzilla 模块的列表。

您可以根据需要多次运行 checksetup.pl 程序,直到您确认安装了所有必需的 perl 模块。

以下是第一次运行 checksetup.pl 的输出,其中列出了所有缺少的可选和必需模块。

# cd /var/www/html/bugzilla-3.4.6

# ./checksetup.pl --check-modules

COMMANDS TO INSTALL OPTIONAL MODULES:

             GD: /usr/bin/perl install-module.pl GD
          Chart: /usr/bin/perl install-module.pl Chart::Base
    Template-GD: /usr/bin/perl install-module.pl Template::Plugin::GD::Image
     GDTextUtil: /usr/bin/perl install-module.pl GD::Text
        GDGraph: /usr/bin/perl install-module.pl GD::Graph
       XML-Twig: /usr/bin/perl install-module.pl XML::Twig
     MIME-tools: /usr/bin/perl install-module.pl MIME::Parser
    libwww-perl: /usr/bin/perl install-module.pl LWP::UserAgent
    PatchReader: /usr/bin/perl install-module.pl PatchReader
     PerlMagick: /usr/bin/perl install-module.pl Image::Magick
      perl-ldap: /usr/bin/perl install-module.pl Net::LDAP
    Authen-SASL: /usr/bin/perl install-module.pl Authen::SASL
     RadiusPerl: /usr/bin/perl install-module.pl Authen::Radius
      SOAP-Lite: /usr/bin/perl install-module.pl SOAP::Lite
    HTML-Parser: /usr/bin/perl install-module.pl HTML::Parser
  HTML-Scrubber: /usr/bin/perl install-module.pl HTML::Scrubber
Email-MIME-Attachment-Stripper: /usr/bin/perl install-module.pl Email::MIME::Attachment::Stripper
    Email-Reply: /usr/bin/perl install-module.pl Email::Reply
    TheSchwartz: /usr/bin/perl install-module.pl TheSchwartz
 Daemon-Generic: /usr/bin/perl install-module.pl Daemon::Generic
       mod_perl: /usr/bin/perl install-module.pl mod_perl2

YOU MUST RUN ONE OF THE FOLLOWING COMMANDS (depending on which database you use):

PostgreSQL: /usr/bin/perl install-module.pl DBD::Pg
     MySQL: /usr/bin/perl install-module.pl DBD::mysql
    Oracle: /usr/bin/perl install-module.pl DBD::Oracle

COMMANDS TO INSTALL REQUIRED MODULES (You *must* run all these commands and then re-run checksetup.pl):

    /usr/bin/perl install-module.pl CGI
    /usr/bin/perl install-module.pl Digest::SHA
    /usr/bin/perl install-module.pl Date::Format
    /usr/bin/perl install-module.pl DateTime
    /usr/bin/perl install-module.pl DateTime::TimeZone
    /usr/bin/perl install-module.pl Template
    /usr/bin/perl install-module.pl Email::Send
    /usr/bin/perl install-module.pl Email::MIME
    /usr/bin/perl install-module.pl Email::MIME::Encodings
    /usr/bin/perl install-module.pl Email::MIME::Modifier
    /usr/bin/perl install-module.pl URI

To attempt an automatic install of every required and optional module with one command, do:

  /usr/bin/perl install-module.pl --all

6.执行bugzilla install-module.pl

正如 checksetup.pl 的输出所建议的,您可以执行 install-module.pl 来安装所有 bugzilla 必需和可选的 perl 模块。

# /usr/bin/perl install-module.pl --all

请查看上述 install-module.pl 的输出,以确保所有内容都已正确安装。某些模块可能无法安装(可能是因为缺少某些必需的操作系统包)。

执行 checksetup.pl 以验证是否所有模块都已正确安装。

以下是第二次运行 checksetup.pl 的输出:

# ./checksetup.pl --check-modules
COMMANDS TO INSTALL OPTIONAL MODULES:

             GD: /usr/bin/perl install-module.pl GD
          Chart: /usr/bin/perl install-module.pl Chart::Base
    Template-GD: /usr/bin/perl install-module.pl Template::Plugin::GD::Image
     GDTextUtil: /usr/bin/perl install-module.pl GD::Text
        GDGraph: /usr/bin/perl install-module.pl GD::Graph
       XML-Twig: /usr/bin/perl install-module.pl XML::Twig
     PerlMagick: /usr/bin/perl install-module.pl Image::Magick
      SOAP-Lite: /usr/bin/perl install-module.pl SOAP::Lite
       mod_perl: /usr/bin/perl install-module.pl mod_perl2

YOU MUST RUN ONE OF THE FOLLOWING COMMANDS (depending on which database
you use):

PostgreSQL: /usr/bin/perl install-module.pl DBD::Pg
     MySQL: /usr/bin/perl install-module.pl DBD::mysql
    Oracle: /usr/bin/perl install-module.pl DBD::Oracle

7. 安装缺少的 Perl 模块

正如我们从上面的 checksetup.pl 输出中看到的那样,当我们运行 install-module.pl 时,一些可选模块和必需模块的安装没有完成。

因此,我们必须一个一个地手动安装缺少的模块,以找出问题并一个一个地修复它。

请参阅最后的“疑难解答部分”,了解我在安装 bugzilla 所需的 perl 模块时遇到的所有问题(以及如何解决这些问题的解决方案)。

8.最终checksetup.pl --check-modules验证

再次执行 checksetup.pl –check-modules 如下所示作为最终验证,以确保所有模块都安装成功。

# ./checksetup.pl --check-modules
* This is Bugzilla 3.4.6 on perl 5.8.8
* Running on Linux 2.6.18-164.el5PAE #1 SMP Thu Sep 3 04:10:44 EDT 2009

Checking perl modules...
Checking for              CGI.pm (v3.21)   ok: found v3.49
Checking for          Digest-SHA (any)     ok: found v5.48
Checking for            TimeDate (v2.21)   ok: found v2.24
Checking for            DateTime (v0.28)   ok: found v0.55
Checking for   DateTime-TimeZone (v0.71)   ok: found v1.17
Checking for                 DBI (v1.41)   ok: found v1.52
Checking for    Template-Toolkit (v2.22)   ok: found v2.22
Checking for          Email-Send (v2.00)   ok: found v2.198
Checking for          Email-MIME (v1.861)  ok: found v1.903
Checking for Email-MIME-Encodings (v1.313)  ok: found v1.313
Checking for Email-MIME-Modifier (v1.442)  ok: found v1.903
Checking for                 URI (any)     ok: found v1.54 

Checking available perl DBD modules...
Checking for              DBD-Pg (v1.45)    not found
Checking for           DBD-mysql (v4.00)   ok: found v4.013
Checking for          DBD-Oracle (v1.19)    not found 

The following Perl modules are optional:
Checking for                  GD (v1.20)   ok: found v2.44
Checking for               Chart (v1.0)    ok: found v2.4.1
Checking for         Template-GD (any)     ok: found v1.56
Checking for          GDTextUtil (any)     ok: found v0.86
Checking for             GDGraph (any)     ok: found v1.44
Checking for            XML-Twig (any)     ok: found v3.34
Checking for          MIME-tools (v5.406)  ok: found v5.427
Checking for         libwww-perl (any)     ok: found v5.834
Checking for         PatchReader (v0.9.4)  ok: found v0.9.5
Checking for          PerlMagick (any)     ok: found v6.2.8
Checking for           perl-ldap (any)     ok: found v0.4001
Checking for         Authen-SASL (any)     ok: found v2.1401
Checking for          RadiusPerl (any)     ok: found v0.17
Checking for           SOAP-Lite (v0.710.06) ok: found v0.711
Checking for         HTML-Parser (v3.40)   ok: found v3.65
Checking for       HTML-Scrubber (any)     ok: found v0.08
Checking for Email-MIME-Attachment-Stripper (any)     ok: found v1.316
Checking for         Email-Reply (any)     ok: found v1.202
Checking for         TheSchwartz (any)     ok: found v1.10
Checking for      Daemon-Generic (any)     ok: found v0.61
Checking for            mod_perl (v1.999022) ok: found v2.000004

9. 使用 checksetup.pl 创建 localconfig 文件

不带任何参数执行 checksetup.pl,这将在当前目录中创建一个 localconfig 文件。localconfig 文件包含 bugzilla 使用的关键配置参数(例如,mysql db 用户名和密码)。

# ./checksetup.pl
Reading ./localconfig...

This version of Bugzilla contains some variables that you may want to
change and adapt to your local settings. Please edit the file
./localconfig and rerun checksetup.pl.

The following variables are new to ./localconfig since you last ran
checksetup.pl:  create_htaccess, webservergroup, db_driver, db_host, db_name, db_user, db_pass, db_port, db_sock, db_check, index_html, cvsbin, interdiffbin, diffpath, site_wide_secret

10.修改localconfig文件。

您唯一需要修改 localconfig 文件是 MySQL 数据库 db 密码,方法是更改​​ $db_pass 变量,如下所示。

# vi ./localconfig
$db_pass = 'Bugs4All';

11.修改/etc/my.cnf增加bugzilla附件大小

在 /etc/my.cnf 中将 max_allowed_pa​​cket 设置为 4M 以增加 bugzilla 附件大小。

# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

# Allow packets up to 4MB
max_allowed_packet=4M

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

更改后重新启动 mysqld。

# service mysqld restart

12.创建bug mysql用户

将 bugzilla 用户(bugs)添加到 mysql 数据库,如下所示。

# mysql -u root -p

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

mysql> FLUSH PRIVILEGES;

13. 创建 bugzilla 数据库

再次执行 checksetup.pl(不带任何参数)以创建 mysql bugzilla 数据库。由于localconfig文件已经存在,第二次执行checksetup.pl时,会根据localconfig文件中的信息创建mysql数据库。

# ./checksetup.pl 

Creating database bugs...

Building Schema object from database...
Adding new table bz_schema ...
Initializing the new Schema storage...
Adding new table attach_data ...
Adding new table attachments ...
Adding new table bug_group_map ...
Adding new table bug_see_also ...
Adding new table bug_severity ...
Adding new table bug_status ...

Inserting values into the 'priority' table:
Inserting values into the 'bug_status' table:
Inserting values into the 'rep_platform' table:

Creating ./data directory...
Creating ./data/attachments directory...
Creating ./data/duplicates directory...

Adding foreign key: attachments.bug_id -> bugs.bug_id...
Adding foreign key: attachments.submitter_id -> profiles.userid...
Adding foreign key: bug_group_map.bug_id -> bugs.bug_id...

14. 创建 bugzilla 管理员帐户。

在 ./checksetup.pl 执行结束时,它会检测到您没有管理员帐户并要求您输入管理登录信息,如下所示。

Looks like we don't have an administrator set up yet. Either this is
your first time using Bugzilla, or your administrator's privileges
might have accidentally been deleted.

Enter the e-mail address of the administrator: ramesh@thegeekstuff.com
Enter the real name of the administrator: Ramesh Natarajan
Enter a password for the administrator account: NotRealPwd
Please retype the password to verify: welcome
ramesh@thegeekstuff.com is now set up as an administrator.
Creating default classification 'Unclassified'...
Creating initial dummy product 'TestProduct'...

Now that you have installed Bugzilla, you should visit the 'Parameters'
page (linked in the footer of the Administrator account) to ensure it
is set up as you wish - this includes setting the 'urlbase' option to
the correct URL.

15. 为 mod_perl 配置 apache

重命名 bugzilla 目录。(即删除其中的版本号)

# cd /var/www/html

# mv bugzilla-3.4.6/ bugzilla

将以下两行添加到 httpd.conf

#tail -2 /etc/httpd/conf/httpd.conf
PerlSwitches -I/var/www/html/bugzilla -I/var/www/html/bugzilla/lib -w -T
PerlConfigRequire /var/www/html/bugzilla/mod_perl.pl

验证 httpd.conf 中的组与 localconfig 中的 webservergroup 匹配

# cd /var/www/html/bugzilla/

# grep webservergroup localconfig
$webservergroup = 'apache';

# grep Group /etc/httpd/conf/httpd.conf
Group apache

16.最终checksetup.pl执行

再次执行 checksetup.pl。

# ./checksetup.pl
Reading ./localconfig...

Removing existing compiled templates...
Precompiling templates...done.
Fixing file permissions...

Now that you have installed Bugzilla, you should visit the 'Parameters'
page (linked in the footer of the Administrator account) to ensure it
is set up as you wish - this includes setting the 'urlbase' option to
the correct URL.

17. 登录 bugzilla 并完成一次性设置。

启动 apache,转到 http://{your-ip-address}/bugzilla 并使用您在上面创建的管理员帐户登录。
在 bugzilla 用户界面的页脚 -> 管理 -> 参数 -> '必需设置' 部分 -> 填写以下信息:
维护者:ramesh@thegeekstuff.com

urlbase: http://{your-ip-address}/
注意:根据您的设置,转到 -> 用户身份验证 -> 您可能想要更改 requiredlogin 和 emailregexp 参数。

对 Bugzilla 安装问题进行故障排除

问题 1:DBD::mysql 模块失败

DBD:mysql perl 模块失败并显示“mysql.h: No such file or directory”错误消息,如下所示。

# /usr/bin/perl install-module.pl DBD::mysql

dbdimp.h:22:49: error: mysql.h: No such file or directory
dbdimp.h:23:45: error: mysqld_error.h: No such file or directory
dbdimp.h:25:49: error: errmsg.h: No such file or directory
In file included from dbdimp.c:20:
dbdimp.h:144: error: expected specifier-qualifier-list before âMYSQLâ
dbdimp.h:236: error: expected specifier-qualifier-list before âMYSQL_RESâ

解决方案1:安装mysql-devel

错误消息“mysql.h:没有这样的文件或目录”是因为缺少 mysql-devel 包,如下所示。

# rpm -qa | grep -i mysql
MySQL-python-1.2.1-1
mysql-5.0.77-4.el5_4.2
mysql-connector-odbc-3.51.26r1127-1.el5
mysql-server-5.0.77-4.el5_4.2
libdbi-dbd-mysql-0.8.1a-1.2.2
perl-DBD-MySQL-3.0007-2.el5

安装 mysql-devel 包,如下所示。

# yum install mysql-devel

# rpm -qa | grep -i "mysql-devel"
mysql-devel-5.0.77-4.el5_4.2

DBD::mysql 安装现在将顺利完成。

# /usr/bin/perl install-module.pl DBD::mysql

问题 2:GD 因缺少 gdlib-config / libgd 而失败

安装 GD 模块失败,并显示以下错误消息。

# /usr/bin/perl install-module.pl GD

**UNRECOVERABLE ERROR**
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd.
Running make test
  Make had some problems, maybe interrupted? Won't test
Running make install
  Make had some problems, maybe interrupted? Won't install

解决方案2:安装gd-devel包

如下所示安装 libgd(即 gd-devel 包)以修复 GD 模块问题。

# yum install gd-devel

# rpm -qa | grep gd
gd-2.0.33-9.4.el5_4.2
gd-devel-2.0.33-9.4.el5_4.2

安装 gd-devel 包后,GD 安装没有任何问题。

# /usr/bin/perl install-module.pl GD

问题 3:Twig 因 expat.h 错误而失败

Twig 模块安装失败,并显示错误消息“expat.h: No such file or directory”,如下所示。

# /usr/bin/perl install-module.pl XML::Twig

Expat.xs:12:19: error: expat.h: No such file or directory
Expat.xs:60: error: expected specifier-qualifier-list before XML_Parser

解决方案3:为 Twig 安装 expat 和 expat-devel

安装 expat 和 expat-devel 包,如下所示。

# yum install expat

# yum install expat-devel

现在安装 Twig 没有任何问题。

# /usr/bin/perl install-module.pl XML::Twig

问题 4:Image::Magick 安装失败

Image::Magick 安装失败,出现“magick/MagickCore.h: No such file or directory”错误消息,如下所示。

# /usr/bin/perl install-module.pl Image::Magick

Note (probably harmless): No library found for -lMagickCore
Magick.xs:64:31: error: magick/MagickCore.h: No such file or directory
Magick.xs:171: error: expected specifier-qualifier-list before ‘MagickRealType’
Magick.xs:192: error: expected specifier-qualifier-list before ‘ImageInfo’
Magick.xs:214: error: ‘MagickNoiseOptions’ undeclared here (not in a function)
Magick.xs:214: warning: missing initializer

解决方案4:Image::Magick 安装失败

确保存在以下 ImageMagic 相关包。

# rpm -qa | grep -i Image
ImageMagick-6.2.8.0-4.el5_1.1
ImageMagick-c++-devel-6.2.8.0-4.el5_1.1
ImageMagick-devel-6.2.8.0-4.el5_1.1
ImageMagick-c++-6.2.8.0-4.el5_1.1
ImageMagick-perl-6.2.8.0-4.el5_1.1

就我而言, ImageMagic-devel 丢失了。所以,安装它如下所示。之后,Image::Magick perl 模块安装成功。

# yum install ImageMagick-devel

# /usr/bin/perl install-module.pl Image::Magick

问题 5:SOAP::Lite 安装失败

SOAP::Lite 模块安装失败,并显示“Cannot locate version.pm in @INC”消息,如下所示。

#/usr/bin/perl install-module.pl SOAP::Lite

Failed test 'use SOAP::Lite;' at t/SOAP/Data.t line 5.
Tried to use 'SOAP::Lite'.
Error:  Can't locate version.pm in @INC

解决方案5:安装 SOAP::Lite 所需的 version.pm

安装的 version.pm 如下图所示。此后,SOAP::Lite 安装成功,没有任何问题。

# perl -MCPAN -e 'install version' 

# /usr/bin/perl install-module.pl SOAP::Lite

问题 6(和解决方案 6):缺少 mod_perl

不要使用 /usr/bin/perl install-module.pl mod_perl2 安装 mod_perl。insetad,如下图使用yum安装mod_perl。

# yum install mod_perl

问题 7:Apache 启动失败

启动 apache 失败,出现“无法在 @INC 中找到 Template/Config.pm”错误消息。

# service httpd restart
Stopping httpd:                                            [  OK  ]

Starting httpd: Syntax error on line 994 of /etc/httpd/conf/httpd.conf:
Can't locate Template/Config.pm in @INC

解决方案7:安装模板工具包,如下图

安装 Template-Tool kit 来修复上面的 apache 错误信息

# cpan
cpan> i /Template-Toolkit/
Distribution    A/AB/ABEL/Eidolon-Driver-Template-Toolkit-0.01.tar.gz
Distribution    A/AB/ABW/Template-Toolkit-1.07.tar.gz
Distribution    A/AB/ABW/Template-Toolkit-2.22.tar.gz
Distribution    I/IN/INGY/Template-Toolkit-Simple-0.03.tar.gz
4 items found

cpan> install A/AB/ABW/Template-Toolkit-2.22.tar.gz

问题8:Apache启动再次失败

启动 apache 失败并出现“无法在 @INC 中找到 DateTime/Locale.pm”错误消息。

# service httpd restart
Stopping httpd:                                            [  OK  ]

Starting httpd: Syntax error on line 994 of /etc/httpd/conf/httpd.conf:
Can't locate DateTime/Locale.pm in @INC

解决方案8:安装DateTime/Locale.pm,如下图

安装 DateTime/Locale.pm 以修复上述 apache 错误消息

# cpan

cpan> install DateTime:Locale

此外,在您的 apache error_log 中,如果您看到 Digest/SHA.pm 问题,您应该如下所示安装它。

# tail -f /etc/httpd/logs/error_log
Can't locate Digest/SHA.pm in @INC (@INC contains: 

# cpan
cpan> install Digest::SHA
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。