Thursday, July 4, 2019

Install Bugzilla Bug Tracking System On RHEL 7


Bugzilla is an open-source tool used to track bugs and issues of a project or a software. It is widely used as a bug-reporting tool for all types of testing functions.

Prerequisites:


Before installing the Bugzilla first we have to ensure that all packages are up to date

#yum update –y

#yum install epel-release yum-utils –y

Install LAMP Stack:

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

Install  1175 Packages (+68 Dependent packages)

Almost 1300 packages will be installed

Start the Apache and MariaDB services and enable them to start on boot

sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb

Database Configuration:

[root@hrms lib]# mysql --version
mysql  Ver 15.1 Distrib 10.4.6-MariaDB, for Linux (x86_64) using readline 5.1

[bugz@hrms ~]$ sudo 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] Y
 ... Success!

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!

Database and User Creation:

[root@hrms ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.4.6-MariaDB MariaDB Server

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

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

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

MariaDB [(none)]> CREATE USER 'bugs'@'localhost' IDENTIFIED BY '<password>';
Query OK, 0 rows affected (0.076 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON bugs.* TO 'bugs'@'localhost' IDENTIFIED BY '<password>' WITH GRANT OPTION;
Query OK, 0 rows affected (0.027 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> exit;
Bye

Change Configuration:

Edit /etc/my.cnf and add below configurations

[mysqld]
# Allow packets up to 16M
max_allowed_packet=16M

# Allow small words in full-text indexes
ft_min_word_len=2

sudo systemctl restart mariadb

Install Bugzilla:

Download the latest version of the Bugzilla with the wget :

wget http://ftp.mozilla.org/pub/webtools/bugzilla-5.0.6.tar.gz

Once the download is complete, extract the downloaded archive with the gtar command:

gtar -xvzf bugzilla-5.0.6.tar.gz

Move the extracted directory into the Apache web root directory:

sudo mv bugzilla-5.0.6 /var/www/html/bugzilla

Set proper permissions on the bugzilla directory:

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

You will also need to install all necessary Perl modules in your system.

Change into the bugzilla directory:

cd /var/www/html/bugzilla/

Install all the required Perl modules with the following command:

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

Once installation is complete, you need to run checksetup.pl perl script. It will create localconfig file.

You will need to edit localconfig file:

vi /var/www/html/bugzilla/localconfig

Change the file as shown below:

$db_host = 'localhost';
$db_name = '<your dbname>';
$db_user = '<dbuser>';
$db_pass = '<dbpassword>';
$db_port = 3306

Save and close the file when you are finished.

Re-Run the checksetup.pl perl script to install Bugzilla:

cd /var/www/html/bugzilla/
sudo ./checksetup.pl

[bugz@hrms bugzilla]$ sudo ./checksetup.pl
* This is Bugzilla 5.0.6 on perl 5.16.3
* Running on Linux 4.1.12-124.28.5.el7uek.x86_64 #2 SMP Thu Jun 20 12:00:04 PDT 2019

Checking perl modules...
Checking for               CGI.pm (v3.51)     ok: found v3.63
Checking for           Digest-SHA (any)       ok: found v5.85
Checking for             TimeDate (v2.23)     ok: found v2.24
Checking for             DateTime (v0.75)     ok: found v1.04
Checking for    DateTime-TimeZone (v1.64)     ok: found v1.70
Checking for                  DBI (v1.614)    ok: found v1.642
Checking for     Template-Toolkit (v2.24)     ok: found v2.24
Checking for         Email-Sender (v1.300011) ok: found v1.300031
Checking for           Email-MIME (v1.904)    ok: found v1.926
Checking for                  URI (v1.55)     ok: found v1.60
Checking for       List-MoreUtils (v0.32)     ok: found v0.33
Checking for    Math-Random-ISAAC (v1.0.1)    ok: found v1.004
Checking for              JSON-XS (v2.01)     ok: found v3.01

Checking available perl DBD modules...
Checking for               DBD-Pg (v2.7.0)    ok: found v2.19.3
Checking for            DBD-mysql (v4.001)    ok: found v4.050
Checking for           DBD-SQLite (v1.29)     ok: found v1.39
Checking for           DBD-Oracle (v1.19)     not found

The following Perl modules are optional:
Checking for                   GD (v1.20)     ok: found v2.49
Checking for                Chart (v2.4.1)    ok: found v2.4.10
Checking for          Template-GD (any)       ok: found v1.56
Checking for           GDTextUtil (any)       ok: found v0.86
Checking for              GDGraph (any)       ok: found v1.44
Checking for           MIME-tools (v5.406)    ok: found v5.505
Checking for          libwww-perl (any)       ok: found v6.05
Checking for             XML-Twig (any)       ok: found v3.44
Checking for          PatchReader (v0.9.6)    ok: found v0.9.6
Checking for            perl-ldap (any)       ok: found v0.56
Checking for          Authen-SASL (any)       ok: found v2.15
Checking for         Net-SMTP-SSL (v1.01)     ok: found v1.01
Checking for           RadiusPerl (any)       ok: found v0.26
Checking for            SOAP-Lite (v0.712)    ok: found v1.10
Checking for          XMLRPC-Lite (v0.712)    ok: found v0.717
Checking for             JSON-RPC (any)       ok: found v1.03
Checking for           Test-Taint (v1.06)     ok: found v1.06
Checking for          HTML-Parser (v3.67)     ok: found v3.71
Checking for        HTML-Scrubber (any)       ok: found v0.15
Checking for               Encode (v2.21)     ok: found v2.51
Checking for        Encode-Detect (any)       ok: found v1.01
Checking for          Email-Reply (any)       ok: found v1.203
Checking for HTML-FormatText-WithLinks (v0.13)     ok: found v0.14
Checking for          TheSchwartz (v1.07)     ok: found v1.12
Checking for       Daemon-Generic (any)       ok: found v0.85
Checking for             mod_perl (v1.999022) ok: found v2.000010
Checking for     Apache-SizeLimit (v0.96)     ok: found v0.97
Checking for        File-MimeInfo (any)       ok: found v0.21
Checking for           IO-stringy (any)       ok: found v2.110
Checking for      Cache-Memcached (any)       ok: found v1.30
Checking for  File-Copy-Recursive (any)       ok: found v0.38
Checking for           File-Which (any)       ok: found v1.09
Checking for              mod_env (any)       ok
Checking for          mod_expires (any)       ok
Checking for          mod_headers (any)       ok
Checking for          mod_rewrite (any)       ok
Checking for          mod_version (any)       ok
Reading ./localconfig...
Checking for            DBD-mysql (v4.001)    ok: found v4.050
Checking for                MySQL (v5.0.15)   ok: found v10.4.6-MariaDB

Adding new table bz_schema...
Initializing bz_schema...
Creating tables...
Converting attach_data maximum size to 100G...
Setting up choices for standard drop-down fields:
   priority bug_status rep_platform resolution bug_severity op_sys
Creating ./data directory...
Creating ./data/assets directory...
Creating ./data/attachments directory...
Creating ./data/db directory...
Creating ./data/extensions directory...
Creating ./data/mining directory...
Creating ./data/webdot directory...
Creating ./graphs directory...
Creating ./skins/custom directory...
Creating ./data/extensions/additional...
Creating ./data/mailer.testfile...
Creating ./Bugzilla/.htaccess...
Creating ./data/.htaccess...
Creating ./data/assets/.htaccess...
Creating ./data/attachments/.htaccess...
Creating ./data/webdot/.htaccess...
Creating ./graphs/.htaccess...
Creating ./lib/.htaccess...
Creating ./template/.htaccess...
Creating contrib/.htaccess...
Creating t/.htaccess...
Creating xt/.htaccess...
Precompiling templates...done.
Fixing file permissions...
Initializing "Dependency Tree Changes" email_setting ...
Initializing "Product/Component Changes" email_setting ...
Marking closed bug statuses as such...
Creating default classification 'Unclassified'...
Setting up foreign keys...
Setting up the default status workflow...
Creating default groups...
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: <yourmail>
Enter the real name of the administrator: <Name>
Enter a password for the administrator account:
Please retype the password to verify:
<Your mail> 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.

At the end of the script it will ask administrator setup, provide administrator mailid and password.

Comment out a line in the .htaccess file that the Bugzilla installation script created:

[bugz@hrms bugzilla]$ sudo sed -i 's/^Options -Indexes$/#Options -Indexes/g' ./.htaccess
[sudo] password for bugz:

Configure Apache For Bugzilla:

Edit Apache configuration file

sudo vi //etc/httpd/conf/httpd.conf

Add the following lines:

<VirtualHost *:80>
DocumentRoot /var/www/html/bugzilla/
</VirtualHost>
<Directory /var/www/html/bugzilla>
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit FileInfo Indexes
</Directory>

Save the file and restart httpd service for the changes to take effect:

sudo systemctl restart httpd

Allow HTTP traffic on port 80 in firewalld,  if only firewall enabled in server. You can do this by running the following commands:

sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --reload

Acess Bugzilla console:

http://<your-server-ip>


No comments:

Post a Comment