Image by Freepik: www.freepik.com

Build a Disaster Management Hub with a Raspberry Pi

– Featuring Sahana Eden –

When disaster strikes, the ability to manage critical information and provide localized support can mean the difference between chaos and organized response.

As no disaster is announced in advance, the necessary equipment for disaster management will not be present from the first second. This article is intended for communities, private and NGOs without a governmental funding to be able to prepare themselves in advance, as an insurance.

This article demonstrates how to set up a Raspberry Pi 3+ (or newer) as a robust disaster management hub using the LAMP stack (Linux, Apache, MySQL, PHP) and other essential software.


The Challenge

Disaster-affected areas often lack reliable internet and power. Teams on the ground need tools to coordinate resources, manage data, and disseminate vital information – all without relying on external infrastructure. What if there was a portable, cost-effective solution that could fit in your backpack?


The Solution

A Raspberry Pi, when configured with the right software, can serve as a lightweight yet powerful disaster management hub. It can run offline databases, host emergency medical and survival information, and even facilitate local communications.

This tutorial will guide you through setting up a Raspberry Pi with essential tools for disaster management, focusing on the Apache-based LAMP stack.


What You’ll Need for the Raspberry Pi

1. Hardware

  • Raspberry Pi 3+ or newer.
  • 32GB or larger microSD card (preferably 64GB or maybe even 128GB).
  • Power supply compatible with your Raspberry Pi.
  • Optional: USB keyboard, mouse, monitor (for initial setup).
  • USB WiFi dongle (if not built-in) or Ethernet cable.
  • Optional: External SSD or USB drive for additional storage.


2. Software

  • Raspberry Pi Imager (for flashing the OS).
  • Raspberry Pi OS Lite (minimal version).
  • Terminal/SSH client (e.g., PuTTY for Windows, Terminal for macOS/Linux).


Step 1: Flash the OS

1. Download Raspberry Pi OS Lite

  • Get the latest version of Raspberry Pi OS Lite from Raspberry Pi Downloads.


2. Flash the SD Card

  • Use Raspberry Pi Imager or a similar tool to flash the OS onto the microSD card.
  • During configuration:Enable SSH.Set WiFi credentials (if not using Ethernet).Choose a hostname (e.g., disaster-pi).


3. Boot the Raspberry Pi

  • Insert the SD card into the Raspberry Pi and power it on.
  • Connect via SSH or directly using a keyboard and monitor.


Step 2: Update the System

1. Update repositories and software:

bash

sudo apt update && sudo apt upgrade -y

2. Install essential tools:

bash

sudo apt install git wget curl unzip build-essential -y


Step 3: Install Core Services

MySQL Database

1. Install MySQL Server and Client:

bash

sudo apt install mysql-server mysql-client -y

2. Secure the installation:

bash

sudo mysql_secure_installation
  • Set a strong root password.Remove anonymous users and test databases.

3. Create a default database for disaster data:

bash

sudo mysql -u root -p
CREATE DATABASE disaster_db;
GRANT ALL PRIVILEGES ON disaster_db.* TO 'pi_user'@'localhost' IDENTIFIED BY 'strong_password';
FLUSH PRIVILEGES;
EXIT;


Install Apache

1. Install Apache:

bash

sudo apt update
sudo apt install apache2 -y

2. Enable Apache to start on boot:

bash

sudo systemctl enable apache2

3. Verify the installation:

  • Open a web browser and navigate to the Raspberry Pi’s IP address.
  • You should see the default Apache “It works!” page.


Configure Apache for Sahana Eden

1. Set up a virtual host:

bash

sudo nano /etc/apache2/sites-available/eden.conf

2. Add the following configuration:

apache

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/eden
    ServerName localhost

    <Directory /var/www/eden>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

3. Enable the new site and rewrite module:

bash

sudo a2ensite eden.conf
sudo a2enmod rewrite
sudo systemctl restart apache2


Install PHP

1. Install PHP and necessary modules:

bash

sudo apt install php libapache2-mod-php php-mysql -y

2. Verify PHP installation:

  • Create a test file:
bash

sudo nano /var/www/html/info.php
  • Add the following code:
php

<?php
phpinfo();
?>
  • Save the file and access it in your browser: http://<RaspberryPi_IP>/info.php.

3. Remove the test file after verifying:

bash

sudo rm /var/www/html/info.php


Step 4. Install Sahana Eden

1. Install dependencies:

bash

sudo apt install python3-pip python3-dev libmysqlclient-dev -y

2. Clone the Sahana Eden repository:

bash

git clone https://github.com/sahana/eden.git /var/www/eden
cd /var/www/eden
pip3 install -r requirements.txt

3. Configure and start:

  • Follow the Sahana Eden deployment guide for configuration.


Step 5. Install and Configure Medical Tools

WikiMed Offline

1. Download the WikiMed ZIM file:

bash

wget https://download.kiwix.org/zim/wikipedia_en_med.zim -P /var/www/html/

2. Install Kiwix-Serve:

bash

sudo apt install kiwix-tools -y

Configure Kiwix to serve its library on a custom port if needed. This must be a different one that Sahana Eden or any other web service. See the following command.

3. Start the Kiwix server:

bash

kiwix-serve --port=8080 --library /var/www/html/


First Aid Offline:

  • Download and preload a PDF version of the First Aid Handbook or Red Cross Guidelines into /var/www/html/first-aid/.


Step 6: Install Survival Tools

OfflineMap:

1. Install GDAL for handling map files:

bash

sudo apt install gdal-bin -y

2. Download pre-rendered maps:

  • Get OpenStreetMap tiles for your region using tools like MOBAC.


Survival Manuals:

  • Download PDFs of survival guides and place them in /var/www/html/survival/.


Step 7: Optimize for Offline Use

1. Disable unnecessary services to save power:

bash

sudo systemctl disable bluetooth.service

2. Install power management tools:

bash

sudo apt install powertop -y
sudo powertop --calibrate

3. Configure local WiFi hotspot:

  • Use hostapd and dnsmasq to create a WiFi access point for connecting devices.



Step 8: Install Communication Tools

Adding SDR capabilities to your Raspberry Pi disaster hub equips it with robust communication and monitoring tools. From scanning emergency frequencies to decoding digital radio signals, the SDR integration makes your hub even more versatile.


Install software for USB 4G/LTE Modem

Should you have a separate USB 4G/LTE modem, then follow the instructions from the producer on how to install it.

Alternatively, use your mobile phone with a WiFi HotSpot for cellular internet connection. Here you should not need special software.


Install RTL-SDR Tools

RTL-SDR tools are essential for working with SDR hardware:

bash

sudo apt install rtl-sdr -y

You can verify the installation by plugging in your USB SDR receiver and running:

bash

rtl_test

This command will test if your SDR hardware is detected.

You will probably need further installations instructions, hints and trouble shooting from the producer of the SDR dongle.


Install GQRX for SDR Signal Scanning

GQRX is a graphical tool for SDR signal analysis:

1. Install dependencies:

bash

sudo apt install gqrx-sdr -y

2. Launch GQRX:

bash

gqrx
  • Configure the input device to use your RTL-SDR hardware.
  • Adjust frequency settings to scan for signals.


FLdigi and Dire Wolf

1. Install:

bash

sudo apt install fldigi direwolf -y

2. Configure:

  • Use /etc/direwolf.conf to set up sound-based packet radio communication.
  • Set up your audio input and output devices.
  • Select the desired mode (e.g., RTTY, PSK31) for communication.


Install Dump1090 for ADS-B Monitoring

Dump1090 is an application for monitoring aircraft signals, which can be helpful in disaster response:

1. Install Dump1090:

bash

sudo apt install dump1090 -y

2. Run Dump1090:

bash

dump1090 --interactive

This displays real-time aircraft data.


Syncthing:

1. Install:

bash

sudo apt install syncthing -y

2. Start and configure:

bash

syncthing &


Install OpenWebRX for Web-Based SDR

OpenWebRX allows multiple users to access SDR features via a browser:

1. Clone the repository:

bash

git clone https://github.com/jketterl/openwebrx.git

2. Navigate to the directory:

bash

cd openwebrx

3. Install and configure:

bash

./openwebrx.sh

4. Access OpenWebRX through a browser on your network.


Testing the Setup

  1. Plug in your USB SDR receiver.
  2. Launch the relevant tools (GQRX, FLdigi, Dump1090, or OpenWebRX).
  3. Tune to local radio frequencies to scan for communications or test digital modes.


Install and Setting Up Mesh Networking Software

Mesh networking on a Raspberry Pi can enable localized communication without relying on internet access. It’s particularly useful in disaster scenarios for creating self-healing, decentralized communication networks. This tutorial uses B.A.T.M.A.N.-adv (Better Approach To Mobile Adhoc Networking), an advanced and reliable solution for mesh networks.

Additional prerequisites

  • USB WiFi adapters (one for the mesh network, one for internet access if needed).


Install Required Software

Install the dependencies and batctl (the control utility for B.A.T.M.A.N.-adv):

bash

sudo apt install batctl iw wireless-tools -y

Enable B.A.T.M.A.N.-adv Kernel Module

Load the B.A.T.M.A.N.-adv kernel module:

bash

sudo modprobe batman-adv

To make it persistent across reboots, add it to the /etc/modules file:

bash

echo "batman-adv" | sudo tee -a /etc/modules

Configure WiFi Adapter for Mesh Networking

  1. List all available WiFi devices:
bash

iw dev

Identify the interface name of the USB WiFi adapter you’ll use for mesh networking (e.g., wlan1).

2.Bring the interface down:

bash

sudo ip link set wlan1 down

3. Set the WiFi adapter to mesh mode:

bash

sudo iw dev wlan1 set type mp

4. Bring the interface back up:

bash

sudo ip link set wlan1 up


Attach the Interface to B.A.T.M.A.N.-adv

Attach the mesh WiFi interface to the B.A.T.M.A.N.-adv virtual interface:

bash

sudo batctl if add wlan1
sudo ip link set wlan1 up
sudo ip link set bat0 up

Assign an IP Address to the Mesh Network

Assign an IP address to the bat0 interface for communication:

bash

sudo ip addr add 192.168.1.1/24 dev bat0

Repeat on other nodes, incrementing the last octet of the IP address (e.g., 192.168.1.2/24).

Test the Mesh Network

1. Ping another node in the network to ensure connectivity:

bash

ping 192.168.1.2

2. Use batctl commands to analyze the mesh network:

bash

sudo batctl n

This shows neighboring nodes.


Automate Mesh Networking on Boot

Create a startup script to configure the mesh network at boot:

1. Open a new file:

bash

sudo nano /etc/systemd/system/mesh-network.service

2. Add the following content:

ini

[Unit]
Description=Configure Mesh Network
After=network.target

[Service]
ExecStart=/bin/bash /usr/local/bin/mesh-setup.sh
Restart=always

[Install]
WantedBy=multi-user.target

3. Create the setup script:

bash

sudo nano /usr/local/bin/mesh-setup.sh

Add:

bash

#!/bin/bash
ip link set wlan1 down
iw dev wlan1 set type mp
ip link set wlan1 up
batctl if add wlan1
ip link set wlan1 up
ip link set bat0 up
ip addr add 192.168.1.1/24 dev bat0

4. Make the script executable:

bash

sudo chmod +x /usr/local/bin/mesh-setup.sh

5. Enable and start the service:

bash

sudo systemctl enable mesh-network
sudo systemctl start mesh-network


Optional: Add a Web Interface

To manage the mesh network visually, you can install tools like Node-RED or CJDNS.


Step 9: Backup and Finalize

1. Create a backup image of the SD card:

bash

sudo dd if=/dev/sdX of=~/pi-backup.img bs=4M

Note that the X in the above “sdX” won’t be an X, but a number. List you devices before and after inserting the SD card helps to figure it out.

2. Label storage folders for easy access (e.g., /data, /logs).


Testing the Setup

  1. Boot the Raspberry Pi without internet.
  2. Test each service (e.g., database connection, medical information access, survival guides).
  3. Simulate a disaster scenario by sharing data over WiFi or ham radio.


Conclusion

This Raspberry Pi setup offers a robust, portable solution for disaster management. It combines core disaster tools with medical and survival software, all optimized for offline use. Regular updates and backups will keep the system ready for deployment.



Essential Hardware for a Raspberry Pi Disaster Management Hub

Introduction

When disaster strikes, having a compact, efficient, and reliable system is critical for managing resources, communication, and information. While a Raspberry Pi is at the core of this system, additional hardware is necessary to make it truly functional and versatile in challenging environments.

Below is a list of hardware to complement your Raspberry Pi disaster management hub. These items are selected to ensure maximum efficiency and portability.


Essential Hardware Components

1. Power Supply and Backup

  • Power Supply: Ensure a reliable 5V/3A power adapter.
  • Battery Backup: Portable power banks (10,000–20,000 mAh) for extended use during outages.
  • Solar Charger: Small, foldable solar panels to recharge power banks in remote areas.


2. Connectivity Tools

  • WiFi Dongle/Router: For creating a local wireless network if your Pi lacks built-in WiFi or you need extended range.
  • Ethernet Cable: For faster, wired connections when available.
  • USB 4G/LTE Modem or Mobile Phone with WiFi HotSpot: To connect to cellular networks for limited internet access.


3. Storage Devices

  • MicroSD Card: Minimum 32GB, even better 64GB or 128GB, with backups of the OS and software.
  • External USB Drives: For storing larger databases, logs, or additional files (128GB+).


4. Input and Output Devices

  • HDMI Display: Portable screen (7-10 inches) for direct access when no laptop is available.
  • Keyboard and Mouse: Compact and durable wired or wireless options.


5. Networking and Communication

  • Ham Radio Interface: For text-based communication via sound (e.g., FLdigi-compatible).

This might include: A.) USB Sound Card: To manage audio in/out for digital modes like PSK31 or RTTY. – B.) PTT (Push-to-Talk) Interface: A circuit to control the transmission of the radio. – C.) CAT Cable: To control and configure the radio directly from the Raspberry Pi. – D.) Ham Radio Transceiver: A radio capable of operating on amateur bands (e.g., VHF, UHF, or HF).

  • USB SDR Receiver: For scanning local radio frequencies.
  • Mesh Network Nodes: Small devices like GoTenna for creating local mesh networks.


6. Environmental Durability

  • Raspberry Pi Case: Rugged, heat-dissipating cases with waterproofing (if possible).
  • Cooling System: Small heatsinks and a fan to prevent overheating during long use.


7. Medical and Survival Tools

  • Pulse Oximeter and Thermometer: Simple devices to monitor health. – USB-compatible or not.
  • USB Rechargeable Flashlight: Dual-purpose for lighting and signaling.


8. Audio and Video Communication

  • Microphone and Webcam: For recording and broadcasting emergency announcements.
  • Portable Speakers: To amplify critical audio messages.


9. Data Sharing and Duplication

  • USB Hubs: To connect multiple peripherals.


10. Miscellaneous Tools

  • Multimeter: To check voltage and troubleshoot hardware issues.
  • Cable Management Kit: Zip ties, Velcro straps, and cases to keep everything organized.


Consider to keep you hardware dry and protected. Have it well ventilated in hot climates.


Why These Components?

This hardware ensures your Raspberry Pi disaster hub is portable, resilient, and ready to address multiple challenges in disaster scenarios.

From providing local medical information to facilitating communication and coordination, this setup empowers responders with critical tools in one lightweight package.

With these additional hardware components, your Raspberry Pi can evolve from a simple computer to a lifesaving tool in emergencies.

Plan ahead, pack smart, and ensure your team is ready when it matters most.


Any suggestions for improvements or other constructive feedback are welcomed.


#RaspberryPi #DisasterManagement #EmergencyResponse #OpenSource #HumanitarianTech #SDR #MeshNetworking #EmergencyTech