Getting Started

Monero XMR Mining Operation

Introduction

This page will guide you through the process of setting up the Database 4 Everything on your system.


Pre-Requisites

Debian Linux

While db4e is certified for Debian 12 Bookworm Linux, it should work with minimal tweaks on any Linux distribution.

This guide assumes a minimal Debian (NetInst) install with only:

-selected.

Additional Software

Some standard packages are required to setup and run db4e:

sudo apt-get install gnupg curl libhwloc15 rsync python3.11-venv libzmq5 pip

Root Access

The db4e application does NOT require root access to run. However, root access is required to:

You will only be required to use the root password when you install the package pre-requisites and to install the db4e service. The db4e applicaiton NEVER stores the root password.

Dedicated db4e Account

PRO TIP: The best practise is to created a dedicated Linux db4e account named db4e. Have that account own the db4e code and the GitHub Pages repository. This is optional.


Install MongoDB

MongoDB does not ship with Debian, however the good folks at Mongo run their own repository. See Installing MongoDB for detailed instructions on setting up repository access and installing MongoDB.


Create a GitHub Account

If you don’t already have one, you can get a free GitHub account.


Create a Repository

Next you’ll need to create a GitHub repository. This will host the db4e website.


Setup GitHub Pages

You need to configure the repository as a GitHub Pages site. Once you’ve created your repository…


Generate a SSH Key

SSH keys are used to authenticate to GitHub. This is so you can upload report data to your website. Login to GitHub. The SSH key that’s needed is the one associated with the user who will be running the db4e application (e.g. sally, or db4e). The account’s public key is in the user’s home directory:

Check if you already have a SSH key:

ls -l ~/.ssh/id_rsa.pub 

If you do not already have an ssh-key you can easily generate one with the ssh-keygen command:

ssh-keygen -b 10240

When prompted:

Enter file in which to save the key (/home/sally/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 

-simply hit enter (default path, empty passphrase).


Import Key into GitHub

Next you’ll want to import the public part of your new key to GitHub. This file is ~/.ssh/id_rsa.pub.


Setup the db4e Service

See the Setup the db4e Service for information on setting up the db4e service.


Hashrate Reports

The pool, sidechain and mainchain hashrate reports aren’t automatically generated by db4e. Instead you’ll need to setup a cronjob (crontab -e command) to run these reports periodically. Here’s an example crontab entry:

# Generate a hashrates report every hour
0 * * * * /opt/prod/db4e/bin/db4e.sh -r hashrates

IMPORTANT NOTE: The cronjob should be installed using the same Linux account name that you are using to run the db4e application. This account name is referenced in the systemd service definition file (see Setup the db4e Service) and is also the owner of the db4e files and the website repo files.


MongoDB Backups

A comprehensive backup of MongoDb has been implemented by running db4e.sh -b. The code will backup the MongoDB databases into your local GitHub Pages website in the backups directory. Currently the script keeps 7 backups before rotating them out. The implementation also pushes the backups to GitHub so you have off-site storage for free!

PRO-TIP: Create a cronjob to schedule daily backups. E.g.

# Do a daily DB backup at noon
0 12 * * * /opt/prod/db4e/bin/db4e.sh -b