FreeBSD Install Bugzilla With Apache24 SSL

Bugzilla, written by Terry Weissman in 1998 in the TCL programming language, is felt to be very helpful for web developers and system administrators to track various bug problems in application programs. The extraordinary interest has encouraged Terry Weissman to improve Bugzilla's capabilities and convert it into the PERL language and use a MYSQL database.

What's even better is that Bugzilla will provide a report when we have finished tracking the bug. Bugzilla reports are written in various formats such as Atom, iCalendor format and others. The iCalendor format is used when you use the time tracking feature in Bugzilla. There are more formats available in Bugzilla like printable format which contains details of all the bugs, CSV format which can be used to import the list of bugs into a spreadsheet.

This article will explain the installation and configuration procedures for Bugzilla on FreeBSD. In this article, we will configure Bugzilla with Apache24 mod perl and a MySQL server data base.


List of contents
1. Configure Apache24 mod perl
2. Create a Bugzilla Data Base
3. Installation and Configuration of Bugzilla


1. Apache24 mod perl configuration

To run Bugzilla with the Apache24 web server, you must use the Perl mod. For a complete discussion of installing Apache24 in Perl mode, you can read our previous article, namely.


In this article we will focus on configuring Apache24 for Bugzilla settings, and we will assume that you have activated Apache24 with perl mod. First activate the Apache24 module required by Bugzilla. Open the /usr/local/etc/httpd.conf file and remove the "#" sign in the following module.

LoadModule authn_socache_module libexec/apache24/mod_authn_socache.so
LoadModule socache_shmcb_module libexec/apache24/mod_socache_shmcb.so
LoadModule expires_module libexec/apache24/mod_expires.so
LoadModule ssl_module libexec/apache24/mod_ssl.so
LoadModule cgi_module libexec/apache24/mod_cgi.so
LoadModule rewrite_module libexec/apache24/mod_rewrite.so

We continue by creating an ssl directory, which will be used to store the ssl files. Here's how to create an SSL certificate for Bugzilla.

root@ns1:~ # cd /usr/local/etc/apache24/
root@ns1:/usr/local/etc/apache24 #
mkdir ssl && cd ssl
root@ns1:/usr/local/etc/apache24/ssl #
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /usr/local/etc/apache24/ssl/bugzilla.key -out /usr/local/etc/apache24/ssl/bugzilla.crt
Generating a RSA private key
.....................................................................................+++++
...................................+++++
writing new private key to '/usr/local/etc/apache24/ssl/bugzilla.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:id
State or Province Name (full name) [Some-State]:jawa barat
Locality Name (eg, city) []:bekasi
Organization Name (eg, company) [Internet Widgits Pty Ltd]:mediatama
Organizational Unit Name (eg, section) []:networking
Common Name (e.g. server FQDN or YOUR name) []:unixexplore.com
Email Address []:datainchi@gmail.com

root@ns1:/usr/local/etc/apache24/ssl #
chmod 600 *

After the SSL certificate has been successfully created, continue by editing the /usr/local/etc/apache24/extra/httpd-vhosts.conf file. Delete all the contents of the files in /usr/local/etc/apache24/extra/httpd-vhosts.conf and replace them with the following script.

<VirtualHost *:80>
ServerName unixexplore.com
ServerAlias www.unixexplore.com
DocumentRoot /usr/local/www/bugzilla
Redirect permanent / https://unixexplore.com/
</VirtualHost>


Listen 443
<VirtualHost _default_:443>
ServerName unixexplore.com
DocumentRoot /usr/local/www/bugzilla
ErrorLog "/var/log/mybugzilla.me-error_log"
CustomLog "/var/log/mybugzilla.me-access_log" common

SSLEngine On
SSLCertificateFile /usr/local/etc/apache24/ssl/bugzilla.crt
SSLCertificateKeyFile /usr/local/etc/apache24/ssl/bugzilla.key

<Directory "/usr/local/www/bugzilla">
AddHandler cgi-script .cgi
Options +ExecCGI
DirectoryIndex index.cgi index.html
AllowOverride Limit FileInfo Indexes Options
Require all granted
</Directory>
</VirtualHost>

Servername matches the domain on your FreeBSD server. Then you activate the vhost mod in the /usr/local/etc/apache24/httpd.conf file. Remove the "#" sign in the following script.

LoadModule vhost_alias_module libexec/apache24/mod_vhost_alias.so
Include etc/apache24/extra/httpd-vhosts.conf


2. Creating a Bugzilla Database

After completing configuring Apache24, continue by creating a Bugzilla database. In this article we will create the Bbugzilla data base with MySQL Server 8, in this article we will not explain how to install MySQL Server 8. You can read the previous article which explains how to configure MySQL Server on FreeBSD.

"Learn to Install MySQL Server on a FreeBSD Machine"

So that Bugzilla can be used together with MySQL Server for new MySQL users, this is also intended to increase the security of Bugzilla users, because if Bugzilla uses the MySQL root user it is very vulnerable to intruders.

We will use the SQL GRANT command to create the user "Bugzilla". It also restricts the "Bugzilla" user from operating within the database, and only allows accounts to connect from "localhost". The following is how to create a Bugzilla database with MySQL Server version 8.

root@ns1:~ # mysql -u root -p -e "create database bugzilla_database"
Enter password:
router
root@ns1:~ #
mysql -u root -p -e "show databases"
Enter password:
router
+--------------------+
| Database |
+--------------------+
| bugdb |
| bugzilla_database |
| bugzilla_demo |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+


The script above is to create a data base "bugzilla_database", and the router is the MySQL Server root password on my FreeBSD machine. After the Bugzilla data base is created, continue with the following script.

root@ns1:~ # mysql -u root -p
Enter password:
router
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.33 Source distribution

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

root@localhost [(none)]>
create user 'userzilla'@'localhost' IDENTIFIED BY 'userzilla@123';
Query OK, 0 rows affected (0.05 sec)

root@localhost [(none)]>
grant all privileges on bugzilla_database.* to 'userzilla'@'localhost';
Query OK, 0 rows affected (0.04 sec)

root@localhost [(none)]>
flush privileges;
Query OK, 0 rows affected (0.01 sec)

root@localhost [(none)]>
\q
Bye


The script above creates a Bugzilla user with the username 'userzilla'@'localhost' and the password 'userzilla@123'.


3. Bugzilla Installation and Configuration

Apache24 has been configured and we have created the Bugzilla data base, then we continue with installing and configuring the Bugzilla program. Here's how to install Bugzilla on FreeBSD.

root@ns1:~ # cd /usr/ports/devel/bugzilla50
root@ns1:/usr/ports/devel/bugzilla50 #
make install clean
====> Compressing man pages (compress-man)
===> Installing for bugzilla50-5.0.4_3
===> Checking if bugzilla50 is already installed
===> Registering installation for bugzilla50-5.0.4_3
Installing bugzilla50-5.0.4_3...
Bugzilla has now been installed. To quick setup you have to:

1. Create database user who has rights on bugs database manipulation
by following mysql commands (for MySQL 4.0 or later):

GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,
CREATE TEMPORARY TABLES, DROP, REFERENCES
ON <database>.* TO <dbuser>@<host>
IDENTIFIED BY '<password>';
FLUSH PRIVILEGES;

where <database> is a bugs database name; <dbuser> is a bugs database
owner; <host> is a host there bugzilla is being setup;
<password> is a database owner's password;

2. Change working directory to /usr/local/www/bugzilla
3. Run "./checksetup.pl" script as root user
4. Read output carefully and follow all instructions

For more complete database setup and post-installation instructions
and security tips/notes please read "Bugzilla Guide" in
/usr/local/share/doc/bugzilla/en/html/ (chapter 2: "Installing Bugzilla")
For upgrades:
0. Back up your data.

1. Run the command inside /usr/local/www/bugzilla
find . -mindepth 2 -name .htaccess -exec rm -f {} \;

2. Run "./checksetup.pl" inside /usr/local/www/bugzilla. You may need to
run it several times.

3. Restart your Web server, especially if you're using mod_perl: this
will save you from a number of troubles.


Continue by installing p5-DBD-mysql.

root@ns1:~ # cd /usr/ports/databases/p5-DBD-mysql
root@ns1:/usr/ports/databases/p5-DBD-mysql #
make install clean

After that, open the file /usr/local/www/bugzilla/localconfig then edit the following script according to the Bugzilla data base that we have created with MySql Server above.

$db_host = 'localhost';
$db_name = 'bugzilla_database';
$db_user = 'userzilla'@'localhost';
$db_pass = 'userzilla@123';

For other scripts in the /usr/local/www/bugzilla/localconfig file, just leave the default, don't change anything except the script above. Then you install the Bugzilla module, here's how to install it.

root@ns1:~ # cd /usr/local/www/bugzilla
root@ns1:/usr/local/www/bugzilla #
/usr/local/bin/perl install-module.pl --all

Next is the perl module test program for Bugzilla.

root@ns1:/usr/local/www/bugzilla # ./checksetup.pl

The final step is to reboot/restart the computer.

root@ns1:~ # reboot

Bugzilla is a very efficient and effective web utility used for bug tracking. However, there is some room for improvement as well. It is widely used by many developers and system administrators around the world. Even many famous companies use this web-based bug tracking tool like Wikipedia and Mozilla. But there are many downsides too. With increasing competition among web development tools, bugzilla is long gone. With such an old user interface, developers and software engineers no longer like it. Many new features that are easily accessible by other bug tracking tools, are not present in bugzilla.
Iwan Setiawan

I Like Adventure: Mahameru Mount, Rinjani Mount I Like Writer FreeBSD

Post a Comment

Previous Post Next Post