3.2. Quick Start (Ubuntu Linux 22.04)
*************************************

This quick start guide makes installing Bugzilla as simple as possible
for those who are able to choose their environment. It creates a
system using Ubuntu Linux 22.04 LTS, Apache and MariaDB. It requires a
little familiarity with Linux and the command line.

Note:

  Harmony’s dependencies have major changes from previous versions of
  Bugzilla. The libraries are now installed as local Perl modules via
  "carton" instead as system-wide Debian packages.


3.2.1. Running On Your Own Hardware
===================================

Ubuntu 22.04 LTS Server requires a 64-bit processor. Bugzilla itself
has no prerequisites beyond that, although you should pick reliable
hardware.


3.2.1.1. Install the OS
-----------------------

Get Ubuntu Server 22.04 LTS and follow the installation instructions.
Here are some tips:

* You do not need an encrypted lvm group, root or home directory.

* Choose all the defaults for the “partitioning” part (excepting of
  course where the default is “No” and you need to press “Yes” to
  continue).

* Choose any server name you like.

* When creating the initial Linux user, call it "bugzilla", give it a
  strong password, and write that password down.

* From the install options, choose “OpenSSH Server”.

Reboot when the installer finishes.


3.2.1.2. Become root
--------------------

ssh to the machine as the ‘bugzilla’ user, or start a console. Then:

**sudo su**


3.2.2. Running on a VPS (Virtual Private Server)
================================================


3.2.2.1. Creating a VPS
-----------------------

Create a new VPS instance using Ubuntu 22.04 (LTS) for AMD64
architectures.

Choose an instance of at least 1GB memory and sufficient disc for the
MariaDB instance, an SSD is preferred.


3.2.2.2. Root Access
--------------------

Depending on your provider, you may be creating a user in the
"sudoers" group, or providing a public key to a SSH certificate you
create on your computer which will you allow you to connect to the VPS
as root, which you will need in the following steps.

Warning:

  Do not set a password for root on your VPS server. Either use an SSH
  key to connect as root, or log in as an unprivileged user in the
  "sudoers" group.


3.2.2.3. Become root
--------------------

Switch to the root user, either by logging in as an unprivileged user,
and running the command:

**sudo su**

or logging in as root using a SSH key.


3.2.3. Install Prerequisites
============================

As root, run the following:

**apt install git nano build-essential mariadb-server libmariadb-dev
perlmagick graphviz python3-sphinx rst2pdf carton**


3.2.4. Configure MySQL
======================

The following instructions use the simple "nano" editor you installed
in the previous step, but use any text editor you are comfortable
with.

**nano /etc/mysql/mariadb.conf.d/50-server.cnf**

Set the following values, which increase the maximum attachment size
and make it possible to search for short words and terms:

* Uncomment and alter on Line 34 to have a value of at least:
  "max_allowed_packet=100M"

* Add as new line 42, in the "[mysqld]" section: "ft_min_word_len=2"

Save and exit.

Create a database "bugs" for Bugzilla:

**mysql -u root -e "CREATE DATABASE IF NOT EXISTS bugs CHARACTER SET =
'utf8'"**

Then, add a user to MySQL for Bugzilla to use:

**mysql -u root -e "GRANT ALL PRIVILEGES ON bugs.* TO bugs@localhost
IDENTIFIED BY '$db_pass'"**

Replace "$db_pass" with a strong password you have generated. Write it
down. You should make "$db_pass" different to your password.

Restart MySQL:

**service mysql restart**


3.2.5. Download Bugzilla
========================

Get it from our Git repository:

**mkdir -p /var/www/webapps**

**cd /var/www/webapps**

**git clone https://github.com/bugzilla/harmony.git bugzilla**


3.2.6. Install Bugzilla
=======================

In the same directory you cloned Bugzilla to, run:

**perl Makefile.PL**

**make cpanfile GEN_CPANFILE_ARGS="-D better_xff -D jsonrpc -D xmlrpc
-D mysql"**

**carton install**

The "carton" command will take some time to run.


3.2.7. Check Setup
==================

Bugzilla comes with a "checksetup.pl" script which helps with the
installation process. It will need to be run twice. The first time, it
generates a config file (called "localconfig") for the database access
information.

**./checksetup.pl**


3.2.8. Edit "localconfig"
=========================

Now you can edit the "localconfig" created in the previous step.

**nano localconfig**

You will need to set the following values:

* $db_pass: the password for the bugs user you created in MariaDB a
  few steps ago

* $urlbase: http://localhost:3001/ or http://<ip address>:3001/

* $canonical_urlbase: the value you set in $urlbase


3.2.9. Check Setup (again)
==========================

Run the "checksetup.pl" script again to set up the database.

**./checksetup.pl**


3.2.10. Start Server
====================

The server is started using the "bugzilla.pl" script.

**./bugzilla.pl daemon**

Will start start Bugzilla as a web app on port 3001.


3.2.11. Test Server
===================

**./testserver.pl http://localhost:3001/bugzilla**

All the tests should pass. You will get a warning about failing to run
"gdlib-config"; just ignore it.


3.2.12. Access Via Web Browser
==============================

Access the front page:

**lynx http://localhost:3001/**

It’s not really possible to use Bugzilla for real through Lynx, but
you can view the front page to validate visually that it’s up and
running.

You might well need to configure your DNS such that the server has,
and is reachable by, a name rather than IP address. Doing so is out of
scope of this document. In the mean time, it is available on your
local network at "http://<ip address>/", where "<ip address>" is
(unless you have a complex network setup) the address starting with
192 or 10 displayed when you run **hostname -I**.


3.2.13. Accessing Bugzilla from the Internet
============================================

To be able to access Bugzilla from anywhere in the world, you don’t
have to make it internet facing at all, there are free VPN services
that let you set up your own network that is accessible anywhere. One
of those is Tailscale, which has a fairly accessible Quick Start
guide.

If you are setting up an internet facing Bugzilla, it’s essential to
set up SSL, so that the communication between the server and users is
encrypted. For local and intranet installation this matters less, and
for those cases, you could set up a self signed local certificate
instead.

There are a few ways to set up free SSL thanks to Let’s Encrypt. The
two major ones would be Apache’s mod_md and EFF’s certbot, but we
don’t cover the exact specifics of this here, as that’s out of scope
of this guide.


3.2.14. Configure Bugzilla
==========================

Once you have worked out how to access your Bugzilla in a graphical
web browser, bring up the front page, click Log In in the header, and
log in as the admin user you defined in step 10.

Click the Parameters link on the page it gives you, and set the
following parameters in the Required Settings section:

* urlbase: http://<servername>/ or http://<ip address>/

* ssl_redirect: on if you set up an SSL certificate

Click Save Changes at the bottom of the page.

In order to send bugmail and enable signups for users, you must have:

* A domain that your Bugzilla instance will send mail from.

* An SMTP host

The first is usually the domain or subdomain of your Bugzilla
hostname. You will need to set up MX records for the host or service
at the domain name service provider for that domain, please check with
your email provider’s documentation.

The second is a SMTP server you or your organization uses, or a mail
delivery service such as SendGrid or MailGun.

To configure your Bugzilla installation to send mail, open the Email
section of the Parameters using the link in the left column, and set
the following values:

* mail_delivery_method: SMTP

* mailfrom: user@domain

* smtpserver: smtp.hostname:465

* smtp_username: username

* smtp_password: password

* smtp_ssl: On

Click Save Changes at the bottom of the page.

======================================================================

To report bugs in and suggest updates for this documentation, please
file them on our bug tracker.
