﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-家有小猫's Java Blog-随笔分类-Bugzilla</title><link>http://www.blogjava.net/andyhan/category/15470.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 18:47:44 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 18:47:44 GMT</pubDate><ttl>60</ttl><item><title>Bugzilla 系统配置指南(Win32)</title><link>http://www.blogjava.net/andyhan/archive/2005/07/13/7594.html</link><dc:creator>家有小猫's Java Blog</dc:creator><author>家有小猫's Java Blog</author><pubDate>Wed, 13 Jul 2005 02:45:00 GMT</pubDate><guid>http://www.blogjava.net/andyhan/archive/2005/07/13/7594.html</guid><wfw:comment>http://www.blogjava.net/andyhan/comments/7594.html</wfw:comment><comments>http://www.blogjava.net/andyhan/archive/2005/07/13/7594.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/andyhan/comments/commentRss/7594.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/andyhan/services/trackbacks/7594.html</trackback:ping><description><![CDATA[
		<p>一、安装准备</p>
		<p>Bugzilla： 版本 2.18 （<a href="http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-2.18.tar.gz">http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-2.18.tar.gz</a>）<br />汉化包：2.18rc3-cn-0.9 （<a href="http://heanet.dl.sourceforge.net/sourceforge/bugzilla-cn/bugzilla-2.18rc3-cn-0.9.rar">http://heanet.dl.sourceforge.net/sourceforge/bugzilla-cn/bugzilla-2.18rc3-cn-0.9.rar</a>）-不需要,似乎不兼容</p>
		<p>My SQL Database： 版本 4.1.10 （<a href="http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-4.1.10-win32.zip/from/http://mysql.ihostunit.com/">http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-4.1.10-win32.zip/from/http://mysql.ihostunit.com/</a>）</p>
		<p>ActivePerl：版本 5.8.6.811 （<a href="http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.6.811-MSWin32-x86-122208.msi">http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.6.811-MSWin32-x86-122208.msi</a>）-据说这个版本有bug,但是似乎也没什么大碍.</p>
		<p>Perl Modules：（<a href="http://landfill.bugzilla.org/ppm">http://landfill.bugzilla.org/ppm</a>）</p>
		<p>sendmail：（<a href="http://download.ebugs.org/download/bugzilla/mailer.rar">http://download.ebugs.org/download/bugzilla/mailer.rar</a>）</p>
		<p>Apache：版本 2.0.53 （<a href="http://archive.apache.org/dist/httpd/binaries/win32/apache_2.0.53-win32-x86-no_ssl.msi">http://archive.apache.org/dist/httpd/binaries/win32/apache_2.0.53-win32-x86-no_ssl.msi</a>）</p>
		<p>二、相关软件的安装 </p>
		<p>安装mysql。<br />将Mysql默认安装到C:\Mysql是一个很不错的主意，因为在Bugzilla的Checksetup.pl中默认Mysql安装在C:\mysql，如果您安装到了其他目录，那么安装时需要对该文件进行手工修改，指定Mysql的安装路径。对于Mysql的安装，一路点击下一步即可。<br />安装完成后，手动运行C:\mysql\bin\winmysqladmin.exe文件，它会自动将mysql数据库注册为服务并启动。此操作仅需运行一次，因为Mysql注册的服务为自动类型，所以每次计算机启动时均会自动运行。<br />然后，我们需要mysql中创建Bugzilla的用户以及数据库，主要三条命令为： <br />a、建立数据库bugs <br />create database bugs; </p>
		<p>b、建立用户bugs，密码为空，对Bugs数据库具有一定权限 <br />GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE, LOCK TABLES,DROP,REFERENCES ON bugs.* TO <a href="mailto:bugs@localhost">bugs@localhost</a> IDENTIFIED BY ''; </p>
		<p>c、从 mysql 数据库授权表中重新装载权限。 <br />FLUSH PRIVILEGES</p>
		<p>执行过程如下图：（这里我们建立的数据库名为Bugs，数据库用户名为Bugs，密码为空）</p>
		<p>1. </p>
		<p>注意：刚刚建立的数据库的超级用户为root，没有密码，你可以安装mysqlcc在图形界面中更改密码，也可以使用SQL语句“UPDATE user SET password = password('new_password') WHERE user = 'root';”来更改密码。 </p>
		<p>
				<br />安装Activeperl。<br />Activeperl的安装很简单，一路点击Next即可，它会自动安装到C:\perl目录。同时在系统变量Path中增加自己的 C:\perl\bin路径信息。 </p>
		<p>Apache的配置<br />对于 Apache 服务器，此步骤稍微复杂一点，需要手工配置文本文件：C:\Program Files\Apache Group\Apache2\conf\httpd.conf </p>
		<p>1、增加 cgi 和 pl 的执行，只需要在配置文件中增加如下二行<br />AddHandler cgi-script .cgi<br />AddHandler cgi-script .pl </p>
		<p>2、增加默认文档，在文档中查找DirectoryIndex index.html index.html.var一行，在后面添加index.cgi，即更改为：DirectoryIndex index.html index.html.var index.cgi </p>
		<p>3、增加虚拟目录映射，并设置目录权限。增加下列几行，这里默认Bugzilla文件目录位于C:\Buzilla，别名为bugzilla，注意：在配置文件中是使用“/”而不是“\”<br />Alias /bugzilla "D:/Bugzilla/"<br />&lt;Directory "D:/Bugzilla/"&gt;<br />#<br /># Possible values for the Options directive are "None", "All",<br /># or any combination of:<br />#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews<br />#<br /># Note that "MultiViews" must be named *explicitly* --- "Options All"<br /># doesn't give it to you.<br />#<br /># The Options directive is both complicated and important.  Please see<br /># <a href="http://httpd.apache.org/docs-2.0/mod/core.html#options">http://httpd.apache.org/docs-2.0/mod/core.html#options</a><br /># for more information.<br />#<br />    Options Indexes FollowSymLinks ExecCGI</p>
		<p>#<br /># AllowOverride controls what directives may be placed in .htaccess files.<br /># It can be "All", "None", or any combination of the keywords:<br />#   Options FileInfo AuthConfig Limit<br />#<br />    AllowOverride All</p>
		<p>#<br /># Controls who can get stuff from this server.<br />#<br />    Order allow,deny<br />    Allow from all</p>
		<p>#<br /># Tell Apache to use Perl to execute .cgi<br />#<br />    ScriptInterpreterSource Registry-Strict<br />&lt;/Directory&gt; </p>
		<p>AddHandler cgi-script .cgi</p>
		<p>DirectoryIndex index.html index.html.var index.cgi</p>
		<p>#<br /># The location and format of the access logfile (Common Logfile Format).<br /># If you do not define any access logfiles within a &lt;VirtualHost&gt;<br /># container, they will be logged here.  Contrariwise, if you *do*<br /># define per-&lt;VirtualHost&gt; access logfiles, transactions will be<br /># logged therein and *not* in this file.<br />#<br />#CustomLog logs/access.log common</p>
		<p>
				<br />设置完成后，重新启动 Apache 服务器设置即可生效。</p>
		<p>
				<br />Perl脚本的安装以及Bugzilla的初步配置。<br />Bugzilla为我们准备了一个很好的脚本文件checksetup.pl来进行配置，我们随时可以运行chekcsetup.pl文件来进行服务器配置而不会对Bugzilla系统造成任何影响。<br />运行该脚本的方法是，在命令行下进入Bugzilla的主目录，键入：perl checksetup.pl，运行后，该脚本会给出系统所缺的各种元素乃至获取办法。<br />初次运行的时候，系统首先会验证perl模块是否足够，一般会缺少比较多的perl模块。如果我们是单独下载的每个perl模块进行安装，则需要使用ppm install &lt;perl模块名.ppd&gt; 进行。<br />如果是使用本文中所提供的压缩包进行安装的，那么一切变得很简单，只需要双击运行Install.bat文件，此批处理文件会自动调用ppm安装好运行所需要的perl模块。</p>
		<p>当插件安装完后，再次运行perl checksetup.pl，系统会生成localconfig文件，此文件是包含了Bugzilla的一些配置信息，如果您的mysql安装到C:\mysql，所创建的数据库名称为bugs 数据库用户为bugs，密码为空，那么不需要对localconfig文件进行任何修改，否则需要对localconfig的相应条目进行修改。<br />修改好localconfig文件，再次运行 perl checksetup.pl，如果不出意外的话，会顺利编译模板，然后建立数据库，最后提示输入超级用户信箱、用户姓名以及口令。输入后，Bugzilla 基本安装完成，可以从 web 上来进行访问了。</p>
		<p>
				<br />让Bugzilla界面运行起来！<br />当我们使用 web 页面浏览<a href="http://127.0.0.1/bugzilla/">http://127.0.0.1/bugzilla/</a>时，意外的发现出错了。<br />如果是 IIS ，可能的信息为：<br />CGI Error <br />The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: <br />Can't open perl script "C:\bugzilla\index.cgi": Permission denied <br />如果是 Apache ，可能的错误信息为标准的 500 号内部错误：<br />Internal Server Error<br />The server encountered an internal error or misconfiguration and was unable to complete your request.<br />More information about this error may be available in the server error log. <br />… <br />Apache/2.0.48 (Win32) Server at 127.0.0.1 Port 80&gt; </p>
		<p>虽然提示信息不同，但是二者出错原因是类似的，对于IIS，是因为perl脚本的第一句中不支持 -wT 参数，将所有的 -wT 替换成 -w 即可<br />即：将 #!/usr/bin/perl –wT 替换为：将 #!/usr/bin/perl –w </p>
		<p>对于Apache服务器，是因为Apache找不到perl文件的路径，因此将.cgi和.pl的顶部的perl路径由/use/bin/perl 替换成C:/perl/bin/perl即可。<br />即：将 #!/usr/bin/perl 替换为：#!C:/perl/bin/perl </p>
		<p>作为一个通用的解决方法，可以将所有的#!/usr/bin/perl –wT和#!/usr/bin/perl –w替换成#!C:/perl/bin/perl </p>
		<p>修改后，再次浏览<a href="http://127.0.0.1/bugzilla/">http://127.0.0.1/bugzilla/</a>，OK！我们可以看到Bugzilla的主界面了。 </p>
		<p>
				<br />实现Bugzilla的Email发送功能。<br />因为Bugzilla更大程度是基于unix的，其发送邮件部分功能是直接调用unix下的sendmail来实现的，这就给在windows下运行造成了很大难度。对此，Bugzilla的官方文档给出的办法是将Sendmail部分用perl的Net::Smtp模块来代替。但是在最新的Bugzilla版本中，一共有11个文件需要修改，且各地代码修改方式均有所不同，且目前大部分smtp服务器均需要认证才能发信，将信箱密码写在程序源码中毕竟不是一个好办法，基于以上种种原因，我们自己编程实现了windows下的 sendmail，基本能够完成unix下sendmail的功能。我们需要做的是用新sendmail的路径替换旧有的sendmail路径就可以了。 <br />如：sendmail位于bugzilla目录下的mailer目录下，我们就可以使用“|Mailer/sendmail”替换“|/usr/lib/sendmail”。<br />除此以外，还要将contrib\bug_email.pl中的“| /usr/sbin/sendmail”替换成“|Mailer/sendmail”， contrib\mysqld-watcher.pl 中的“/usr/lib/sendmail”替换成“Mailer/sendmail” </p>
		<p>替换完成后，我们要运行BugMailer.exe进行配置，输入SMTP服务器的地址、端口号以及发信认证相关信息就可以了。配置后，会在当前目录产生配置文件BugMailer.ini，当发送邮件时，如果产生错误，详细信息会产生在当前目录的BugMailer.log文件中。 </p>
		<p>对于Bugzilla，还有5个文件并不是使用配置中所输入的信箱进行发信的，而是使用了固定的用户“bugzilla-admin-daemon”、“bugzilla-request-daemon”来进行发送，而某些需要SMTP认证的邮件服务器是不允许验证用户使用其他人的名称进行发送的，所以需要手工将其替换成BugMailer.exe中输入的邮件地址。<br />包含以下几个文件<br />template\en\default\account\cancel-token.txt.tmpl<br />template\en\default\account\password\forgotten-password.txt.tmpl<br />template\en\default\account\email\change-new.txt.tmpl<br />template\en\default\account\email\change-old.txt.tmpl <br />template\en\default\request\email.txt.tmpl</p>
		<p>
				<br />至此Bugzilla的邮件发送功能基本完成，同时，Bugzilla也已基本安装完成，下一步就是以超级用户登录对 bugzilla进行配置了。 </p>
		<p>三、补充说明</p>
		<p>对于Bugzilla的安装，比较麻烦的就是安装Perl模块及对Bugzilla源文件的修改。安装过程的要点是不断的运行perl checksetup.pl脚本，随时根据里面提示的信息进行相关操作就可以了。</p>
		<p>记得修改Email的头信息的编码为GB2312.这个和语言包相关.而且MySQL最好使用gb2312的编码,和Apache的default charset一致.</p>
		<p>参考文献：<br /><a href="http://ebugs.org/bugzilla/2.php">Installing Bugzilla on Microsoft Windowshttp://ebugs.org/bugzilla/2.php</a></p>
		<p>
				<a href="http://ebugs.org/bugzilla/2.php">Bugzilla 应用(2)——Bugzilla 的安装</a>
				<br />
		</p>
<img src ="http://www.blogjava.net/andyhan/aggbug/7594.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/andyhan/" target="_blank">家有小猫's Java Blog</a> 2005-07-13 10:45 <a href="http://www.blogjava.net/andyhan/archive/2005/07/13/7594.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>