2022-09-03 04:36:26 +00:00
# Install Databag on Raspberry Pi Zero V1.3
2022-09-02 20:02:08 +00:00
2022-09-02 20:22:09 +00:00
These instructions assume you have the following setup:
2022-09-02 20:02:08 +00:00
- reverse proxy with an assigned hostname and certificate forwarding to your Raspberry Pi
- micro usb to ethernet adapter
- address reservation on your router
2023-02-10 23:20:42 +00:00
- software tools for writing image (7zip & rufus, or equivalent)
2022-12-20 23:11:46 +00:00
- reasonably large micro sd card (~16 GB)
2022-09-02 20:02:08 +00:00
## Step 1: setup the hardware
2022-09-02 20:22:09 +00:00
Download the DietPi OS and select the ARMv6 32-bit image:< br / >
https://dietpi.com/downloads/images/DietPi_RPi-ARMv6-Bullseye.7z< br / >
Extract the img file with 7-zip< br / >
Write the img file to the sd card with Rufus< br / >
Insert the sd card in the pi and turn it on< br / >
2022-09-02 20:02:08 +00:00
## Step 2: install the OS
2022-09-02 20:22:09 +00:00
SSH into the pi with root:dietpi< br / >
Watch it update and reboot< br / >
Select the minimal image< br / >
2022-09-02 20:02:08 +00:00
## Step 3: install databag dependencies
2022-09-02 20:22:09 +00:00
apt-get -y install curl< br / >
apt-get -y install net-tools< br / >
apt-get -y install jq< br / >
apt-get -y install netcat< br / >
apt-get -y install unzip< br / >
apt-get -y install wget< br / >
apt-get -y install git< br / >
apt-get -y install vim< br / >
apt-get -y install fail2ban< br / >
apt-get -y install imagemagick-6.q16< br / >
apt-get -y install build-essential< br / >
apt-get -y install sqlite3< br / >
apt-get -y install openssh-client< br / >
2022-09-02 20:02:08 +00:00
## Step 4: install golang
2022-09-02 20:22:09 +00:00
Download the armv6l version:< br / >
https://go.dev/dl/go1.19.linux-armv6l.tar.gz< br / >
Extract it to /usr/local:< br / >
tar -C /usr/local -xzf go1.19.linux-armv6l.tar.gz< br / >
2022-09-02 20:02:08 +00:00
2022-10-26 21:38:23 +00:00
## Step 5: clone and build the server
mkdir /app< br / >
cd /app< br / >
git clone https://github.com/balzack/databag.git< br / >
cd /app/databag/net/server< br / >
/usr/local/go/bin/go build databag< br / >
2024-01-20 00:41:22 +00:00
## Step 6: setup databag store path
2022-09-02 20:22:09 +00:00
mkdir -p /var/lib/databag< br / >
2022-09-02 20:02:08 +00:00
2022-10-26 21:38:23 +00:00
## Step 7: initialize the internal datbase
2022-09-02 20:22:09 +00:00
sqlite3 /var/lib/databag/databag.db "VACUUM;"< br / >
sqlite3 /var/lib/databag/databag.db "CREATE TABLE IF NOT EXISTS 'configs' ('id' integer NOT NULL UNIQUE,'config_id' text NOT NULL,'str_value' text,'num_value' integer,'bool_value' numeric,'bin_value' blob,PRIMARY KEY ('id'));"< br / >
sqlite3 /var/lib/databag/databag.db "CREATE UNIQUE INDEX IF NOT EXISTS 'idx_configs_config_id' ON 'configs'('config_id');"< br / >
2022-09-02 20:02:08 +00:00
## Step 8: download the webapp
2022-12-20 23:13:40 +00:00
// because the react toolchain isn't available for the pi zero, the webapp is built in a github action< br / >
2024-01-20 00:41:22 +00:00
Download webapp.tar.gz from the most recent release:< br / >
https://github.com/balzack/databag/releases/download/v1.1.11/webapp.tar.gz< br / >
SCP webapp.tar.gz into the pi< br / >
2022-09-02 20:22:09 +00:00
Extract it into the web/build directory< br / >
mkdir /app/databag/net/web/build< br / >
2024-01-20 00:41:22 +00:00
tar xf webapp.tar.gz -C /app/databag/net/web/build/< br / >
2022-09-02 20:02:08 +00:00
## Step 9: launch the server
2022-09-02 20:22:09 +00:00
cd /app/databag/net/server< br / >
2024-01-20 00:41:22 +00:00
nohup nice -n -5 /usr/local/go/bin/go run databag -p 443 -s /var/lib/databag -w /app/databag/net/web/build & < br / >
2022-09-02 20:02:08 +00:00
## Step 10: configure the server
2022-09-02 20:22:09 +00:00
Open your brower to the pi hostname< br / >
Click the 'cog' in the upper right< br / >
Set an admin password< br / >
Select the 'cog' to bring up the settings modal< br / >
- set your hostname< br />
- set the key to RSA 2048< br />
2022-09-02 20:02:08 +00:00
## Step 11: create accounts
2022-09-02 20:22:09 +00:00
Still in the admin dashboard< br / >
Click the 'add-user' button< br / >
Open the link in a new tab< br / >
Set a username and password< br / >
Setup your profile< br / >
Connect with contacts on other federated instances< br / >
2022-09-02 20:02:08 +00:00
## Step 12: host for your friends and family
2022-09-02 20:22:09 +00:00
Back in the admin dashboard< br / >
Click the 'add-user' and send the link to anyone you want to host< br / >
2022-09-02 20:02:08 +00:00