Document Research Database Installation Instructions (traditional)

There are two ways of installing the Document Research Database (DRDB):

This page describes the manual approach.

Option 2: Manual Installation

The DRDB uses Apache, PHP and MySQL on the backend and several Javascript libraries for the front end. Instead of Apache, other web servers can probably used as well but you are on your own of how to configure them.

The following steps are needed to get the DRDB up and running. In the text below the DBRD is simply referred to as the project. The following procedures were tested on Ubuntu 18.04.

Install Apache and MySQL

System upgrade and Apache server package installation

sudo apt update && sudo apt upgrade
sudo apt install unzip apache2 php libapache2-mod-php php-gd php-zip

#snakeoil ssl certificates
sudo apt install ssl-cert

Apache modules required by DRDB

sudo apt install mysql-server php-mysql php-mysqlnd

Enable Apache modules

sudo a2enmod rewrite headers
sudo a2enmod php7.2

# RESTART the system after this!

Base directory change

Enable encryption, disable unencrypted access

sudo a2enmod ssl
sudo a2ensite default-ssl.conf
sudo a2dissite 000-default.conf
systemctl reload apache2

SSL configuration

Change php session lifetime

sudo nano /etc/php/7.2/apache2/php.ini

change:
   session.gc_maxlifetime = 14400
 to
   session.gc_maxlifetime = 172800 

sudo service apache2 restart

MYSQL user and database configuration

Create the MYSQL database for the project

sudo mysql -u root

create database YOUR_DATABASE_NAME;

Create the MYSQL user for the project

# Give the user only access to this particular database in MySQL:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON YOUR_DATABASE_NAME.* TO 'YOUR_USERNAME'@'localhost' IDENTIFIED BY PASSWORD '*E6410A45E982DC5A85CA6AE4A14CF2AAE169A37E';

exit;

Web server application and library installation

Unpack Javascript GUI libraries

cd /var/www
tar xvzf 01-drdb-js-libraries.tar.gz
chown -R www-data:www-data *

Create project directory

cd /var/www
sudo mkdir drdb

Deny Directory Listings

# The '-Indexes' is the important part
<Directory /var/www/>
        Options -Indexes +FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

Configure HTTP Digest username/password

<Directory /var/www/drdb>
AuthType Basic
AuthName "drdb"
AuthBasicProvider file
AuthUserFile /drdb-pwd-dir/pwd.txt
Require user john
Require user jane
AllowOverride All
</Directory>

cd /
sudo mkdir /drdb-pwd-dir
sudo chown -R www-data:www-data /drdb-pwd-dir

The usernames/passwords in the file are generated as follows:

#FIRST TIME (ADD -c = create new file)
#sudo htpasswd /drdb-pwd-dir/pwd.txt john
  New password: mypassword
  Re-type new password: mypassword
  Adding password for user john 

#subsequent (-b = batch, password as part of the command:
sudo htpasswd -b /drdb-pwd-dir/pwd.txt jane SecretPassword

Allow .htaccess files to override Apache configuration

Install the php code

cd drdb
tar -xvf ../drdb-php-code.tar 
cd ..
sudo chown -R www-data:www-data drdb

Configure the project

cd /var/www/drdb/config

The config directory contains 4 configuration files that need to be adapted before the MySQL database tables can be initialized.

config.php

database-structure.php

id-structure.php

user-permissions-config.php


Project database initialization

https://192.168.1.42/drdb/index.php?content=bs_first_use_init

Screenshot

tail -n 500 -f /var/www/drdb/log/drdb-logfile.txt 

First document record creation

Bulk Import of Existing Data