Linux小玩意之 在RHEL8.2 上安装bugzilla 管理系统

如何在RHEL8 上安装bugzilla 管理系统

1 环境

  • Red Hat Enterprise Linux release 8.2
  • 4.18.0-193.el8.x86_64
  • 安装必要的rpm包
    1
    yum install -y perl perl-CPAN perl-DBD-MySQL perl-Test-Taint gcc gd gd-devel graphviz patchutils perl-{CGI,DateTime,DateTime-TimeZone,Template-Toolkit,Email-Sender,Email-MIME,List-MoreUtils,Math-Random-ISAAC,JSON-XS,GD} wget curl httpd httpd-devel mariadb mariadb-server


    2 配置数据库 (mariaDB)

    2.1 启用mariadb

    1
    # systemctl enable --now mariadb

    2.2 mariadb 修改密码

    1
    # mysql
    1
    MariaDB [(none)]> use mysql
    1
    MariaDB [mysql]> update user set authentication_string=PASSWORD("sam");
    1
    MariaDB [mysql]>  flush privileges;
    1
    MariaDB [(none)]> quit

    2.3 创建 database 并且配置

    1
    2
    3
    4
    5
    # mysql -p
    MariaDB [(none)]> create database bugs;
    MariaDB [(none)]> grant all on bugs.* to bugadmin@localhost identified by 'sam';
    MariaDB [(none)]> flush privileges;
    MariaDB [(none)]> quit

    2.4 添加 max_allowed_packet=16M ft_min_word_len=2 到配置文件

    1
    2
    3
    4
    5
    6
    7
    8
    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    log-error=/var/log/mariadb/mariadb.log
    pid-file=/run/mariadb/mariadb.pid

    max_allowed_packet=16M
    ft_min_word_len=2

    2.5 重启mariadb服务

    1
    systemctl restart mariadb


    3 安装配置bugzilla

    3.1 下载 bugzilla (当前最新版本是5.1.2)

    1
    (vm3) # wget https://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-5.1.2.tar.gz

    3.2 解压

    1
    2
    # mkdir /var/www/html/bugzilla
    # tar xf bugzilla-5.1.2.tar.gz -C /var/www/html/bugzilla --strip-components=1

    3.3 修改 /var/www/html/bugzilla/localconfig 配置文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    $create_htaccess = 1;
    $webservergroup = 'apache';
    $use_suexec = 0;
    $db_from_env = 0;
    $db_driver = 'mysql'; # 需求修改为mysql
    $db_host = 'localhost';
    $db_name = 'bugs'; # 修改数据库名字与前面 2.3 步骤对应
    $db_user = 'bugadmin'; # 修改用户名,与前面2.3 步骤对应
    $db_pass = '';
    $db_port = 0;
    $db_sock = '';
    $db_check = 1;
    $db_mysql_ssl_ca_file = ''; #如果需要ssl,则添加这个部分。
    $db_mysql_ssl_ca_path = ''; #如果需要ssl,则添加这个部分。
    $db_mysql_ssl_client_cert = '';#如果需要ssl,则添加这个部分。
    $db_mysql_ssl_client_key = '';#如果需要ssl,则添加这个部分。
    $index_html = 0;
    $interdiffbin = '/usr/bin/interdiff';
    $diffpath = '/usr/bin';
    $font_file = '';
    $webdotbase = '';
    $site_wide_secret = 'MPlN1jO8o1wvUcXMhUptse5pplN3BQW3nqp61zH3JKJPVvHC6JanUht0EC3qJKUh';
    $apache_size_limit = 250000;

    3.4 检查配置并且安装

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    # /var/www/html/bugzilla/checksetup.pl
    ......
    Enter the e-mail address of the administrator: xili@redhat.com # 管理员的邮箱
    Enter the login name the administrator will log in with: samlee # 管理员的名字
    Enter the real name of the administrator: sam
    Enter a password for the administrator account: # 输入管理面密码
    Please retype the password to verify: # 再次输入管理面密码
    samlee is now set up as an administrator.
    Creating initial dummy product 'TestProduct'... # 默认建立的product
    ......
    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.

    3.5 配置httpd 用的文件 /etc/httpd/conf.d/bugzilla.conf

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    ServerName 150.150.150.30 # 解决 “AH00558: httpd: Could not reliably determine the server's fully qualified domain name”
    <VirtualHost *:80>
    DocumentRoot /var/www/html/bugzilla

    <Directory /var/www/html/bugzilla/>
    AddHandler cgi-script .cgi
    Options +Indexes +ExecCGI
    DirectoryIndex index.cgi
    AllowOverride Limit FileInfo Indexes Options AuthConfig
    AllowOverride None # 解决 you don't have permission to access this resource
    Require all granted # 解决 you don't have permission to access this resource
    </Directory>

    ErrorLog /var/log/httpd/bugzilla.error_log
    CustomLog /var/log/httpd/bugzilla.access_log common
    </VirtualHost>

    3.6 修改文件夹权限

    1
    chown -R apache: /var/www/html/bugzilla/

    3.7 测试http 配置

    1
    2
    # httpd -t
    Syntax OK

    3.8 启动httpd

    1
    # systemctl enable httpd --now

    3.9 测试 bugzilla 是否正常

    1
    2
    3
    4
    5
    6
    7
    (vm3) # /var/www/html/bugzilla/testserver.pl  http://150.150.150.30
    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-FAILED Webserver is permitting fetch of http://150.150.150.30/localconfig. # 暂时忽略
    This is a serious security problem.
    Check your web server configuration.


    4 使用 web 界面登陆

    4.1 使用我们之前3.4 创建管理员账户登陆

    bugzilla_login.png

    4.2 创建一个新的用户

    bugzilla_newuser.png

    4.3 创建一个新的bug

    bugzilla_newbug.png


    5 附录

    5.1 修改mysql 密码

  • 方法 1
    1
    2
    mysql> use mysql;
    mysql> SET PASSWORD FOR 'root' = PASSWORD('new_password');
  • 方法 2
    1
    2
    mysql> use mysql;
    mysql> update user set authentication_string=password('1111') where user='root';