Linux (Ubuntu) Bugzilla

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

測試環境為 Ubuntu 16.04 x86_64 (IP: 172.16.15.129)虛擬機

MySQL (MariaDB) Database

因為 Bugzilla 會將資料儲存在 database 中,Ubuntu 16.04 採用 MariaDB 為預設的資料庫系統.

root@ubuntu:~# apt-get install mariadb-server

確定一下 MariaDB 執行中.

root@ubuntu:~# systemctl status mysql

資料庫初始化設定.
雖然我 Disallow root login remotely 設定為 n , Ubuntu 還需要將 /etc/mysql/my.cnf (Ubuntu 14.04) , /etc/mysql/mariadb.conf.d/50-server.cnf (Ubuntu16.04) 裡面的 bind-address = 127.0.0.1 註記起來 (#後面文字表示為說明),才能讓使用者遠端登入.

root@ubuntu:~# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

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

root@ubuntu:~# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 50
Server version: 10.0.33-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

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@ubuntu:~# mysql -u bugzillauser -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 51
Server version: 10.0.33-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

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:    52
Current database: bugzilla

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

MariaDB [bugzilla]> exit;
Bye

安裝 Bugzilla

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

root@ubuntu:~# cd /var/www/html
root@ubuntu:/var/www/html# wget https://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-5.0.3.tar.gz
root@ubuntu:/var/www/html# tar zxvf bugzilla-5.0.3.tar.gz

解開的檔案目錄有點長,所以修改成簡短一點 bugzilla ,以方便輸入 https://Your_IP/bugzilla/

root@ubuntu:/var/www/html# mv bugzilla-5.0.3 bugzilla
root@ubuntu:/var/www/html# cd bugzilla/

先做環境檢查,

root@ubuntu:/var/www/html/bugzilla# ./checksetup.pl
...
To attempt an automatic install of every required and optional module
with one command, do:

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

*** Installation aborted. Read the messages above. ***

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

Bugzilla (CGI-perl)

Bugzilla 使用 CGI (Common Gateway Interface)-perl 的網頁程式語言.

root@ubuntu:/var/www/html/bugzilla# /usr/bin/perl install-module.pl --all

Apache 需要設定來支援.

root@ubuntu:~# nano /etc/apache2/apache2.conf
<Directory /var/www/html/bugzilla>
  AddHandler cgi-script .cgi
  Options +ExecCGI +FollowSymLinks
  DirectoryIndex index.cgi index.html
  AllowOverride All
</Directory>
root@ubuntu:~# sudo a2enmod cgi
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Enabling module cgi.
To activate the new configuration, you need to run:
  service apache2 restart
root@ubuntu:~# systemctl restart apache2
root@ubuntu:~# systemctl status apache2

Bugzilla 設定

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

root@ubuntu:/var/www/html/bugzilla# nano localconfig
# If you set this to anything other than "", you will need to run checksetup.pl
# as root or as a user who is a member of the specified group.
$webservergroup = 'www-data';

# The DNS name or IP address of the host that the database server runs on.
$db_host = 'localhost';

# The name of the database. For Oracle, this is the database's SID. For
# SQLite, this is a name (or path) for the DB file.
$db_name = 'bugzilla';

# Who we connect to the database as.
$db_user = 'bugzillauser';

# Enter your database password here. It's normally advisable to specify
# a password for your bugzilla database user.
# If you use apostrophe (') or a backslash (\) in your password, you'll
# need to escape it by preceding it with a '\' character. (\') or (\)
# (It is far simpler to just not use those characters.)
$db_pass = '111111';
root@ubuntu:/var/www/html/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.

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

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

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

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