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. For optimal performance, the included XMRig miner needs to access Model-Specific Registers (MSRs). This requires root access. To handle this db4e sets the SUID bit on the XMRig binary.

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.

To test that this worked, go the command line of your machine and issue the command below:

ssh -T git@github.com

Sample output:

Hi SallyKolodny! You've successfully authenticated, but GitHub does not provide shell access.

Clone the db4e Repository

Use the command below to clone the db4e repository.

git clone git@github.com:NadimGhaznavi/db4e

Launch the db4e-os Tool

Optionally, for ease of use, I recommend adding the bin directory to your path. For example, if you cloned db4e into your home directory, /home/sally/db4e, then add this line to the bottom of your .bashrc file:

export PATH=$PATH:/home/sally/db4e/bin

You can launch the db4e-os tool by running the shell wrapper:

db4e/bin/db4e-os.sh

The first time you run the tool it will create a Python venv environment that’s required to run db4e.

IMPORTANT NOTE: This is beta code: The software is not fully operational and is under active development.


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