如何在Ubuntu / CentOS 6.x上安装Bugzilla4.4

来源:互联网 发布:惠州干部网络大学堂 编辑:程序博客网 时间:2024/05/22 15:29

如何在Ubuntu / CentOS 6.x上安装Bugzilla4.4

 

1. 安装依赖程序

安装Bugzilla相当简单。这篇文章特别针对Ubuntu 14.04CentOS 6.5两个版本(不过也适用于更老的版本)

为了获取并能在UbuntuCentOS系统中运行Bugzilla,我们要安装Apache网络服务器(启用SSL)MySQL数据库服务器和一些需要来安装并配置Bugzilla的工具。

要在你的服务器上安装使用Bugzilla,你需要安装好以下程序:

  • Perl(5.8.1 或以上)
  • MySQL
  • Apache2
  • Bugzilla
  • Perl模块
  • 使用apache的Bugzilla

正如我们所提到的本文会阐述Ubuntu 14.04CentOS 6.5/7两种发行版的安装过程,为此我们会分成两部分来表示。

以下就是在你的Ubuntu 14.04 LTSCentOS 7机器安装Bugzilla的步骤:

准备所需的依赖包:

你需要运行以下命令来安装些必要的包:

Ubuntu版本:

$ sudo apt-get install apache2 mysql-serverlibapache2-mod-perl2 libapache2-mod-perl2-dev libapache2-mod-perl2-doc perlpostfix make gcc g++

CentOS版本:

$ sudo yum install httpd mod_sslmysql-server mysql php-mysql gcc perl* mod_perl-devel

注意:请在shell或者终端下运行所有的命令并且确保你用root用户(sudo)操作机器。

2. 启动Apache服务

你已经按照以上步骤安装好了apache服务,那么我们现在需要配置apache服务并运行它。我们需要用sodoroot来敲命令去完成它,我们先切换到root连接。

$ sudo -s

我们需要在防火墙中打开80端口并保存改动。

# iptables -I INPUT -p tcp --dport 80 -jACCEPT

# service iptables save

现在,我们需要启动服务:

CentOS版本:

# service httpd start

我们来确保Apache会在每次你重启机器的时候一并启动起来:

# /sbin/chkconfig httpd on

Ubuntu版本:

# service apache2 start

现在,由于我们已经启动了我们apachehttp服务,我们就能在默认的127.0.0.1地址下打开apache服务了。

3. 配置MySQL服务器

现在我们需要启动我们的MySQL服务:

CentOS版本:

# chkconfig mysqld on

# service mysqld start

Ubuntu版本:

# service mysql-server start

root用户登录连接MySQL并给Bugzilla创建一个数据库,把你的mysql密码更改成你想要的,稍后配置Bugzilla的时候会用到它。

CentOS 6.5Ubuntu 14.04 Trusty两个版本:

# mysql -u root -p

 

# password: (You'll need to enter yourpassword)

 

# mysql > create database bugs;

 

# mysql > grant all on bugs.* toroot@localhost identified by "mypassword";

 

#mysql > quit

注意:请记住数据库名和mysql的密码,我们稍后会用到它们。

4. 安装并配置Bugzilla

现在,我们所有需要的包已经设置完毕并运行起来了,我们就要配置我们的Bugzilla

那么,首先我们要下载最新版的Bugzilla包,这里我下载的是4.5.2版本。

使用wget工具在shell或终端上下载:

wgethttp://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.5.2.tar.gz

你也可以从官方网站进行下载。http://www.bugzilla.org/download/

从下载下来的bugzilla压缩包中提取文件并重命名:

# tar zxvf bugzilla-4.5.2.tar.gz -C/var/www/html/

 

# cd /var/www/html/

 

# mv -v bugzilla-4.5.2 bugzilla

注意:这里,/var/www/html/bugzilla/就是Bugzilla主目录.

现在,我们来配置buzilla

# cd /var/www/html/bugzilla/

 

./checksetup.pl --check-modules

检查完成之后,我们会发现缺少了一些组件,我们需要安装它们,用以下命令即可实现:

# cd /var/www/html/bugzilla

# perl install-module.pl --all

这一步会花掉一点时间去下载安装所有依赖程序,然后再次运行checksetup.pl--check-modules命令来验证有没有漏装什么。

现在我们需要运行以下这条命令,它会在/var/www/html/bugzilla路径下自动生成一个名为localconfig的文件。

# ./checksetup.pl

确认一下你刚才在localconfig文件中所输入的数据库名、用户和密码是否正确。

# nano ./localconfig

 

# checksetup.pl

如果一切正常,checksetup.pl现在应该就成功地配置Bugzilla了。

现在我们需要添加Bugzilla至我们的Apache配置文件中。那么,我们需要用文本编辑器打开 /etc/httpd/conf/httpd.conf文件(CentOS版本)或者 /etc/apache2/apache2.conf文件(Ubuntu版本)

CentOS版本:

# nano /etc/httpd/conf/httpd.conf

Ubuntu版本:

# nano etc/apache2/apache2.conf

现在,我们需要配置Apache服务器,我们要把以下配置添加到配置文件里:

<VirtualHost *:80>

    DocumentRoot /var/www/html/bugzilla/

</VirtualHost>

 

<Directory /var/www/html/bugzilla>

    AddHandler cgi-script .cgi

    Options Indexes FollowSymLinks ExecCGI

    DirectoryIndex index.cgi index.html

    AllowOverride All

    order deny,allow

    Allow from all

    #AllowOverride Limit FileInfo Indexes

</Directory>

接着,我们需要编辑 .htaccess文件并用“#”注释掉顶部“Options -Indexes”这一行。

让我们重启我们的apache服务并测试下我们的安装情况。

CentOS版本:

# service httpd restart

Ubuntu版本:

# service apache2 restart

4,权限添加
chown -R root.apache bugzilla/
chmod -R 777 bugzilla/

 

Q&A常见问题解决:

一、

bugzilla配置邮件:

1.SMTP这个在安装了bugzilla 后,在administartor菜单中可以设定

2.sendmail设定,这个是使用了linux 命令的mail 命令来发送的,所有如果你的mail 命令可以发送的话就可以配置成功,不过也会出现下面的问题

  There was anerror sending mail from '3333333@qq.com' to 'sw22aiwai@163.com': error whenclosing pipe to /usr/lib/sendmail: Configuration error (EX_CONFIG)

 

下面是解决方法

Excecutethe below command

$sestatus -b | grep sendmail 

httpd_can_sendmail                   off

Then to actually fix the problem:

$restorecon /usr/sbin/sendmail

$setsebool -P httpd_can_sendmail1

--------可能出现的问题

报错信息如上,仔细看了下报错,不能直接锁定xxx文件然后我把/etc/selinux/targeted/modules/semanage.trans.LOCK移动到其他地方试了下,我擦,它好了,不知道什么情况,

[root@localhost modules]# ls 

active  semanage.read.LOCK  semanage.trans.LOCK tmp

[root@localhost modules]# cat semanage.trans.LOCK 

[root@localhost modules]# mv semanage.trans.LOCK ../

[root@localhost modules]# ls 

active  semanage.read.LOCK  tmp

[root@localhost modules]# setsebool -Psamba_export_all_rw on

[root@localhost modules]# getsebool -a |grep samba

二、

 bugzilla安装完成后,在浏览器中提示:You don't have permission to access /bugzilla/index.cgi on thisserver,在网上查了好久,终于在一个国外的帖子中找到解决问题的办法。

以下是帖子原文:

You have selinux enabled and the contexts aren't set correctly on the

Bugzilla files. Type "getenforce" to see if selinux is enabled. The

quick test is to type "setenforce 0"to turn off selinux and see if that

fixes it. If so, you should fix the contexts so that it works correctly

with selinux enabled. You can use "ls -lZ" on a directory to view the

current context information. Compare it to the contexts used by

apache's cgi-bin directory. That's what Bugzilla needs. You can set it

with "chcon -R context-info /path/to/bugzilla", replacingcontext-info

with what was displayed for the cgi-bin directory.

三、

CentOS 加入域

0 0