Linux (CentOS) Bugzilla

Loading

在自己系統建立 Bugzilla 系統,需要下面幾個服務.

  • MySQL (MariaDB) Database
  • Apache2 (Web server)
  • phpMyAdmin (非必要)

設定請參考 https://benjr.tw/323

  • Bugzilla

測試環境為 CentOS 7 x86_64 (IP: 172.16.15.129)虛擬機

所需套件

[root@localhost ~]$ yum install -y httpd mariadb mariadb-server httpd-devel mod_ssl mod_ssl mariadb-devel php-mysql gcc gcc-c++ graphviz graphviz-devel patchutils gd gd-devel wget perl*

設定 bugzilla 所需資料庫

接下來我們要為將來使用的 Bugzilla 建立一個資料庫,方法很簡單只要下面幾個步驟,建立一個資料庫名稱為 Bugzilla 以及使用者帳號 Bugzillasuser 以及其該使用者密碼 password,你可以依據自己的喜好來命名.

[root@localhost ~]$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

這邊就是要建立 bugzilla 專用的資料庫,create database 資料庫名稱你可以依據自己的需求做改變,注意每個指令後面都要加上 “;”

MariaDB [(none)]> CREATE DATABASE bugzilla;
Query OK, 1 row affected (0.00 sec)

建立 bugzillasuser 這個帳號.

MariaDB [(none)]> CREATE USER bugzillauser@localhost IDENTIFIED BY '111111';
Query OK, 0 rows affected (0.00 sec)
  • CREATE USER bugzillauser@localhost
    username@localhost , username – 新增的使用者, localhost – 限制可從哪裡來存取, 可用 ‘%’ (代表全部)
  • IDENTIFIED BY ‘111111’
    password: 使用者密碼

將剛剛建立的 bugzilla 資料庫權限給 bugzillauser.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON bugzilla.* TO bugzillauser@localhost;
Query OK, 0 rows affected (0.00 sec)
  • GRANT ALL PRIVILEGES
    授權的權限 (ALL: SELECT, INSERT, DELETE …. etc)
  • bugzilla.*
    指定可以存取哪些 Db_name/Table
  • bugzillauser@localhost
    username@localhost , username – 新增的使用者, localhost – 限制可從哪裡來存取, 可用 ‘%’ (代表全部)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit;
Bye

試一下剛剛建立好的 bugzilla 資料庫和使用者吧!!這邊要輸入的密碼是 bugzillauser 的密碼,我剛剛設定的是 password.

[root@localhost ~]$ mysql -u bugzillauser -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> connect bugzilla;
Connection id:    18
Current database: bugzilla

MariaDB [bugzilla]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bugzilla           |
+--------------------+
2 rows in set (0.00 sec)

MariaDB [bugzilla]> exit;
Bye

安裝 Bugzilla

Apache 預設的 http Root 為 /var/www/html ,透過 wget 下載 bugzilla (須自行確認最新版本為何)

[root@localhost ~]$ cd /var/www/html
[root@localhost html]$ wget https://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-5.0.3.tar.gz
[root@localhost html]$ tar zxvf bugzilla-5.0.3.tar.gz
[root@localhost html]$ mv bugzilla-5.0.3/ bugzilla/
[root@localhost html]$ cd bugzilla/

目前我們還欠缺一些 CGI-perl 的安裝.

[root@localhost bugzilla]$ /usr/bin/perl install-module.pl --all

安裝完畢後再次檢查.

[root@localhost bugzilla]$ ./checksetup.pl
...
Reading ./localconfig...

This version of Bugzilla contains some variables that you may want to
change and adapt to your local settings. The following variables are
new to ./localconfig since you last ran checksetup.pl:

create_htaccess, webservergroup, use_suexec, db_driver, db_host,
db_name, db_user, db_pass, db_port, db_sock, db_check,
db_mysql_ssl_ca_file, db_mysql_ssl_ca_path, db_mysql_ssl_client_cert,
db_mysql_ssl_client_key, index_html, interdiffbin, diffpath,
site_wide_secret

Please edit the file ./localconfig and then re-run checksetup.pl
to complete your installation.

Apache CGI

Bugzilla 使用 CGI (Common Gateway Interface)-perl 的網頁程式語言.
Apache 安裝好之後預設會新增一個資料夾 /var/www/cgi-bin ,這個資料夾可以存放 (Common Gateway Interface)-perl 網頁程式語言,如果其他資料夾也要能執行 CGI 需要額外設定 httpd.conf ,我的 bugzilla 資料夾 存放在 /var/www/html/bugzilla .

[root@localhost ~]$ vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/html/bugzilla">
   AddHandler cgi-script .cgi
   Options +ExecCGI +FollowSymLinks
   DirectoryIndex index.cgi index.html
   AllowOverride All
</Directory>
  • Directory
    定義 “/var/www/html/bugzilla” 資料夾權限.
  • AddHandler
    cgi-script .cgi 指定哪一類型 CGI 程式副檔案可以執行.
  • Options
    +ExecCGI 表示該目錄下可以允許 CGI 程式的執行, +FollowSymLinks 表示該目錄下的連結檔為可以使用.
  • DirectoryIndex
    預設開啟該目錄下的 index 順序 index.cgi index.html
  • AllowOverride
    All 時會使用 .htaccess 的設定.
[root@localhost bugzilla]$ systemctl restart httpd
[root@localhost bugzilla]$ systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since 二 2018-01-23 17:47:19 CST; 10s ago

Bugzilla 設定

Bugzilla 設定檔 localconfig ,需要輸入 web user (Ubuntu 為 www-data), 以及資料庫對應的位置,資料庫名稱,使用者及其密碼.

[root@localhost bugzilla]$ vi localconfig
$webservergroup = 'apache';
$db_host = 'localhost';
$db_name = 'bugzilla';
$db_user = 'bugzillauser';
$db_pass = '111111';
[root@localhost bugzilla]$ ./checksetup.pl
...
Setting up user preferences...

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: admin@ooxx.com
Enter the real name of the administrator: admin
Enter a password for the administrator account: 
Please retype the password to verify: 
sunchiahome@gmail.com is now set up as an administrator.
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.
checksetup.pl complete.
[root@localhost bugzilla]$ ./testserver.pl http://172.16.15.129/bugzilla
TEST-OK Webserver is running under group id in $webservergroup.
TEST-OK Got padlock picture.
TEST-OK Webserver is executing CGIs via mod_cgi.
TEST-OK Webserver is preventing fetch of http://172.16.15.129/bugzilla/localconfig.
TEST-OK GD version 2.49, libgd version 2.0.34; Major versions match.
TEST-OK GD library generated a good PNG image.
TEST-OK Chart library generated a good PNG image.
TEST-OK Template::Plugin::GD is installed.

在瀏覽器輸入 http://your_IP/bugzilla
在 Log In 輸入剛剛在安裝的 admin@ooxx.com 與密碼即可登入 bugzilla.

沒有解決問題,試試搜尋本站其他內容

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料