Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1964673
  • 博文数量: 185
  • 博客积分: 10707
  • 博客等级: 上将
  • 技术积分: 1777
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-19 17:31
文章分类

全部博文(185)

文章存档

2014年(1)

2012年(6)

2011年(27)

2010年(13)

2009年(75)

2008年(63)

分类: 系统运维

2009-05-24 22:40:23

之前组里因为项目需要,我配置了一个bugzilla,中间也遇到一些小小麻烦,于是对过程作了一些记录;运行几个月后, 又从外网移动到内网,也作了一些记录,于是形成了这两篇短文《bugzilla安装配置过程小记》和《bugzilla迁移过程小记》,以备忘,希望对大 家有参考意义。
    注:关于发送邮件那段代码,我也是google得到,已忘了出处,请见谅。

0。准备:
    已安装apache, mysql 3.23+, perl 5.6+
    下载bugzilla2.18.4,最新的2.20版要求Perl的模块DBD::mysql 2.9以上,安装这个模块很麻烦,这里省去,退而采用bugzilla 2.18.4版
  

1。运行checksetup.pl检查需要的包,如果缺少模块,可以用 CPAN 安装模块 "Bundle::Bugzilla"

eg. 手动安装xxx模块
perl -MCPAN -e install 'xxx'

2。修改checksetup.pl生成的localconfig,尤其是
     $db_host = "localhost";
  $db_name = "bugs";
  $db_user = "bugs";
  $db_pass = "xxxx";

3。在mysql中建立数据库

create database bugs;

GRANT SELECT,INSERT,UPDATE,DELETE,INDEX, ALTER,CREATE,DROP,
    REFERENCES ON bugs.* TO
    bugs@localhost IDENTIFIED BY 'xxxx';

FLUSH PRIVILEGES;

注意这里 IDENTIFIED BY 'xxxx'中的xxxx要和$db_pass 中设置的密码相同。

4。再次执行checksetup.pl

5。配置apache
假定你的机器IP叫YourIP,其中apache的配置文件是./etc/httpd/conf/httpd.conf

修改端口:Listen 8080
允许执行cgi:AddHandler cgi-script.cgi

增加目录:
Alias /bugzilla/ "/var/www/html/bugzilla-2.18.4"
 
    Options ExecCGI
    AllowOverride Limit
 


配置DirectoryIndex,在 那一行的最后加入index.cgi之后,以便在进入 Bugzilla 目录时查找 index.cgi 文件:
DirectoryIndex index.html index.html.var index.cgi

修改默认字符集以支持中文:
AddDefaultCharset 把 ISO-8859-1 改成 GB2312

可执行文件是 /usr/sbin/httpd

6。重启apache
/sbin/service httpd restart

7。访问方式:
    http://
YourIP:8080/bugzilla/
    
8。界面汉化成中文
    没做

9。关于邮件服务器
    先暂时用一个现成的邮箱
    修改BugzillaBugMail.pm文件,不用sendmail,而用其他的邮件服务器来发邮件,用帐号(假定为
XXXbugs@xxx.com)发邮件!
    (修改sub MessageToMTA ($;$)函数
    
    修改后的函数如下(注意用你真实的邮件服务器ip替换10.61.0.9,用一个真实邮箱替换XXXbugs@xxx.com,作为bugzilla给其成员发送邮件时使用的邮箱,用真实的邮箱帐号和密码替换XXXbugs和XXXbugsPwd):
    sub MessageToMTA ($;$) {
      my ($msg, $rcpt_to) = (@_);
        #add this line
        my ($msg,$person) = (@_);
            
    my $sendmailparam = "";
    unless (Param("sendmailnow")) {
       $sendmailparam = "-ODeliveryMode=deferred";
    }

    if ($enableSendMail == 1) {
    # remove these lines
    #    open(SENDMAIL, "|/usr/lib/sendmail $sendmailparam -t -i") ||
    #      die "Can't open sendmail";
        #
    #    print SENDMAIL trim($msg) . "\n";
    #    close SENDMAIL;
    #
    # add these lines
          use Net::SMTP;
        my $smtp_server = '10.61.0.9';
        # Use die on error, so that the mail will be in the 'unsent mails' and
        # can be sent from the sanity check page.
        my $smtp = Net::SMTP->new($smtp_server) ||
        die 'Cannot connect to server \'$smtp_server\'';

        # auth sender, XXXbugs is the mailbox used as bugzilla daemon.
        $smtp->auth('XXXbugs', 'XXXbugsPwd') or die "auth error\n";
         $smtp->mail('XXXbugs@xxx.com');#from person
         $smtp->to($person); #...........person.........
         $smtp->data();
         $smtp->datasend($msg); #...........msg.........
         $smtp->dataend();
         $smtp->quit;
    }
    }
    
    
    
    修改后,先用test.pl测试,报告Can't locate Authen/SASL.pm in @INC,
    用 /usr/bin/perl -MCPAN -e 'install "Authen::SASL"' 安装Authen::SASL模块!
    
10。从管理页面,将邮件模板的发件人改为
XXXbugs@xxx.com(原来是bugzilla-daemon)
    
    也可以从bugzilla的安装目录,把各个邮件模板的发件人都改为
XXXbugs@xxx.com!(原来是bugzilla-admin-daemon)
    这样用户有问题时可以回复给此邮件!
    
data/template/template/en/default/account/password/forgotten-password.txt.tmpl:    $output .=  "\nFrom: bugzilla-admin-daemon\nTo: ";
data/template/template/en/default/account/cancel-token.txt.tmpl:    $output .=  "\n\nFrom: bugzilla-admin-daemon\nTo: ";
data/template/template/en/default/account/email/change-new.txt.tmpl:    $output .=  "\nFrom: bugzilla-admin-daemon\nTo: ";
data/template/template/en/default/account/email/change-old.txt.tmpl:    $output .=  "\nFrom: bugzilla-admin-daemon\nTo: ";
template/en/default/account/cancel-token.txt.tmpl:From: bugzilla-admin-daemon
template/en/default/account/email/change-new.txt.tmpl:From: bugzilla-admin-daemon
template/en/default/account/email/change-old.txt.tmpl:From: bugzilla-admin-daemon
template/en/default/account/password/forgotten-password.txt.tmpl:From: bugzilla-admin-daemon
阅读(3070) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~