IMPORTANT UPDATE: For DD-WRT auto-start configuration, see AUTOSTART_SETUP.md which includes the
mount --bindfix for read-only filesystem issues.
This guide covers installing EmergencyBox on an ASUS RT-AC68U router running either Asuswrt-Merlin or DD-WRT firmware.
- ASUS RT-AC68U router
- SSH access to the router
- USB storage device (recommended: 8GB+ for file storage)
- Basic knowledge of Linux command line
-
Download DD-WRT for RT-AC68U: https://dd-wrt.com/support/router-database/
-
Flash firmware via router web interface
-
Factory reset after flashing
- Go to Services > USB
- Enable Core USB Support
- Enable USB Storage Support
- Apply settings
# SSH into router
ssh root@192.168.1.1
# Install Entware (DD-WRT version)
wget http://bin.entware.net/armv7sf-k3.2/installer/generic.sh
sh generic.sh
# Update
opkg update
opkg upgradeDD-WRT typically has better PHP support:
# Install packages
opkg install php7 php7-cgi php7-mod-sqlite3 php7-mod-fileinfo
opkg install lighttpd lighttpd-mod-fastcgi
opkg install sqlite3-cli
# Verify
php -v# Create web directory
mkdir -p /opt/share/www
mkdir -p /opt/share/www/uploads/{emergency,media,documents,general}
mkdir -p /opt/share/data
# Copy EmergencyBox files to router
# From your computer, use SCP:
scp -r www/* admin@192.168.1.1:/opt/share/www/
scp -r config/* admin@192.168.1.1:/opt/etc/
# Set permissions
chmod -R 755 /opt/share/www
chmod -R 777 /opt/share/www/uploads
chmod -R 755 /opt/share/data# Backup original config
cp /opt/etc/lighttpd/lighttpd.conf /opt/etc/lighttpd/lighttpd.conf.bak
# Copy EmergencyBox config
cp /opt/etc/lighttpd.conf /opt/etc/lighttpd/lighttpd.conf
# Adjust paths if needed
vi /opt/etc/lighttpd/lighttpd.conf# Copy PHP configuration
cp /opt/etc/php.ini /opt/etc/php.ini
# Verify max upload settings
grep upload_max_filesize /opt/etc/php.ini
grep post_max_size /opt/etc/php.ini# Run database initialization
php /opt/share/www/api/init_db.php
# Verify database was created
ls -lh /opt/share/data/emergencybox.db# Start lighttpd
/opt/etc/init.d/S80lighttpd start
# Check if running
ps | grep lighttpd
# Check logs
tail -f /opt/var/log/lighttpd/error.logCreate startup script:
vi /jffs/scripts/post-mount
# Add the following:
#!/bin/sh
sleep 5
/opt/etc/init.d/S80lighttpd startMake it executable:
chmod +x /jffs/scripts/post-mount- Connect to your router's WiFi network
- Open browser and navigate to: http://192.168.1.1
- You should see the EmergencyBox interface
- Test chat functionality
- Test file upload (start with small file)
- Test large file upload (5GB test)
Problem: No PHP packages in opkg list
Solutions:
- Use DD-WRT instead - DD-WRT typically has better package support
- Compile PHP manually - Advanced users only
- Use alternative backend - Consider Python/Flask or Node.js alternatives
Problem: Uploads fail for files >100MB
Check:
-
PHP settings in
/opt/etc/php.ini:upload_max_filesize = 5Gpost_max_size = 5Gmax_execution_time = 600max_input_time = 600memory_limit = 256M
-
lighttpd settings in
/opt/etc/lighttpd/lighttpd.conf:server.max-request-size = 5368709120server.max-write-idle = 600
-
Restart services:
/opt/etc/init.d/S80lighttpd restart
Problem: SQLite errors or missing database
Solution:
# Recreate database
rm /opt/share/data/emergencybox.db
php /opt/share/www/api/init_db.php
# Check permissions
chmod 755 /opt/share/data
chmod 644 /opt/share/data/emergencybox.db-
Download the latest Asuswrt-Merlin firmware for RT-AC68U from: [https://www.asuswrt-merlin.net/download]
-
Flash the firmware through the router's web interface:
- Login to router admin panel (usually http://192.168.1.1)
- Go to Administration > Firmware Upgrade
- Upload the .trx or .w file
- Wait for reboot (5-10 minutes)
- Login to router web interface
- Go to Administration > System
- Enable SSH: Set to "LAN only"
- Enable JFFS custom scripts and configs
- Apply settings
SSH into your router:
ssh admin@192.168.1.1Install Entware:
# Mount USB drive (if not already mounted)
# The USB drive should be formatted as ext4 for best compatibility
# Download and run Entware installer
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | sh
# Update package list
opkg updateCRITICAL: PHP Version Compatibility
The RT-AC68U runs on an ARM architecture. You need to verify which PHP version is available for your kernel:
# Check your kernel version
uname -r
# List available PHP packages
opkg list | grep phpFor Asuswrt-Merlin (kernel 2.6.36.4):
If PHP 7.x or 8.x is not available in Entware, you have two options:
Option A: Use available PHP version
# Install whatever PHP version is available
opkg install php7-cli php7-cgi php7-mod-sqlite3 php7-mod-fileinfo
# OR if PHP 8 is available
opkg install php8-cli php8-cgi php8-mod-sqlite3 php8-mod-fileinfoOption B: Manual PHP Installation
If Entware has no PHP packages, you'll need to compile PHP manually or use a pre-compiled binary:
# This is complex and not recommended unless necessary
# Consider switching to DD-WRT instead (see Option 1)Install web server and other dependencies:
# Install lighttpd
opkg install lighttpd lighttpd-mod-fastcgi
# Install SQLite3
opkg install sqlite3-cli
# Verify installations
php -v
lighttpd -v
sqlite3 -version# Create web directory
mkdir -p /opt/share/www
mkdir -p /opt/share/www/uploads/{emergency,media,documents,general}
mkdir -p /opt/share/data
# Copy EmergencyBox files to router
# From your computer, use SCP:
scp -r www/* admin@192.168.1.1:/opt/share/www/
scp -r config/* admin@192.168.1.1:/opt/etc/
# Set permissions
chmod -R 755 /opt/share/www
chmod -R 777 /opt/share/www/uploads
chmod -R 755 /opt/share/data# Backup original config
cp /opt/etc/lighttpd/lighttpd.conf /opt/etc/lighttpd/lighttpd.conf.bak
# Copy EmergencyBox config
cp /opt/etc/lighttpd.conf /opt/etc/lighttpd/lighttpd.conf
# Adjust paths if needed
vi /opt/etc/lighttpd/lighttpd.conf# Copy PHP configuration
cp /opt/etc/php.ini /opt/etc/php.ini
# Verify max upload settings
grep upload_max_filesize /opt/etc/php.ini
grep post_max_size /opt/etc/php.ini# Run database initialization
php /opt/share/www/api/init_db.php
# Verify database was created
ls -lh /opt/share/data/emergencybox.db# Start lighttpd
/opt/etc/init.d/S80lighttpd start
# Check if running
ps | grep lighttpd
# Check logs
tail -f /opt/var/log/lighttpd/error.logCreate startup script:
vi /jffs/scripts/post-mount
# Add the following:
#!/bin/sh
sleep 5
/opt/etc/init.d/S80lighttpd startMake it executable:
chmod +x /jffs/scripts/post-mount- Connect to your router's WiFi network
- Open browser and navigate to: http://192.168.1.1
- You should see the EmergencyBox interface
- Test chat functionality
- Test file upload (start with small file)
- Test large file upload (5GB test)
Problem: Router crashes or services stop during large uploads
Solutions:
- Increase swap space on USB drive
- Reduce PHP memory_limit
- Limit concurrent uploads
- Use a larger USB drive
Problem: EmergencyBox not available after router reboot
Solution:
# Check post-mount script
cat /jffs/scripts/post-mount
# Ensure it's executable
chmod +x /jffs/scripts/post-mount
# Test manually
/jffs/scripts/post-mount- Use USB 3.0 drive if supported
- Format USB as ext4 (not FAT32)
- Enable jumbo frames if all devices support it
- Disable unnecessary services on router
Edit /opt/etc/lighttpd/lighttpd.conf:
server.max-connections = 100 # Increase from 50
server.max-fds = 512 # Increase from 256
Edit /opt/etc/php.ini:
PHP_FCGI_CHILDREN = 4 # Increase from 2
Since EmergencyBox is designed for offline disaster scenarios:
- Change default router password - Always use a strong password
- Disable WAN access - Only allow LAN connections
- Use WPA2 encryption - Secure the WiFi network
- Regular backups - Backup the SQLite database periodically
- File scanning - Be aware that uploaded files are not scanned for malware
# Copy database to USB
cp /opt/share/data/emergencybox.db /mnt/usb/backups/
# Or download via SCP
scp admin@192.168.1.1:/opt/share/data/emergencybox.db ./backup.db# Find files older than 30 days
find /opt/share/www/uploads -type f -mtime +30
# Delete if needed
find /opt/share/www/uploads -type f -mtime +30 -delete# Check disk usage
df -h
# Check upload folder size
du -sh /opt/share/www/uploads- See USAGE.md for user guide
- See DEVELOPMENT.md for customization
- See BACKUP.md for backup strategies