Getting RaspAP working on an OrangePi Zero 3 with Ubuntu 24.04
This little blog contains the script to get RaspAP working on my OrangePi Zero 3 (OPZ3). At the time of writing, the RaspAP quick installer script did not support Ubuntu 24.04 on my OPZ3. Indeed, trying to use the script terminates after some running with a incompatible version error.
So, I decided to try and install RaspAP manually, based on the manual installation instructions on the site. It mostly went smoothly, with some hiccups along the way. Some tweaks needed were about disabling wpa_supplicant and a missing library for isoquery.
Some configuration details:
- OrangePi Zero 3 with 1GB ram
- Ubuntu 24.04 (6.12.23) server image downloaded from the Armbian site
- After all the apt upgrades and updates, the kernal was updated to 6.12.35
Attached below is the finalised consolidated script that was used.
#!/bin/bash
echo
echo "######################################"
read -p "Start installation - initial software - press Enter to start"
sudo rfkill unblock wlan
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install -y dhcpcd5
sudo apt-get install -y libjson-glib-dev
echo
echo "######################################"
read -p "Installing isoquery - check result of the -v - press Enter to start"
wget https://ftp.debian.org/debian/pool/main/i/isoquery/isoquery_3.3.4-1+b1_arm64.deb -P /tmp
sudo dpkg -x /tmp/isoquery_3.3.4-1+b1_arm64.deb /tmp/isoquery/
sudo cp /tmp/isoquery/usr/bin/isoquery /usr/local/bin/
sudo chmod +x /usr/local/bin/isoquery
isoquery -v
echo
echo "######################################"
read -p "Stop resolved and add parms - press Enter to start"
sudo systemctl stop systemd-resolved.service
echo "DNS=9.9.9.9" | sudo tee -a /etc/systemd/resolved.conf
echo "DNSStubListener=no" | sudo tee -a /etc/systemd/resolved.conf
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
echo
echo "######################################"
read -p "Install most of the software - press Enter to start"
sudo apt-get install -y lighttpd git hostapd dnsmasq iptables-persistent vnstat qrencode php8.2-cgi jq isoquery
echo
echo "######################################"
read -p "Enable php and start lighttpd - press Enter to start"
sudo lighttpd-enable-mod fastcgi-php
sudo service lighttpd force-reload
sudo systemctl restart lighttpd.service
echo
echo "######################################"
read -p "Pull the web application - press Enter to start"
sudo rm -rf /var/www/html
sudo git clone --recurse-submodules https://github.com/RaspAP/raspap-webgui /var/www/html
sudo git -C /var/www/html submodule update --remote plugins
WEBROOT="/var/www/html"
CONFSRC="$WEBROOT/config/50-raspap-router.conf"
LTROOT=$(grep "server.document-root" /etc/lighttpd/lighttpd.conf | awk -F '=' '{print $2}' | tr -d " \"")
HTROOT=${WEBROOT/$LTROOT}
HTROOT=$(echo "$HTROOT" | sed -e 's/\/$//')
awk "{gsub(\"/REPLACE_ME\",\"$HTROOT\")}1" $CONFSRC > /tmp/50-raspap-router.conf
sudo cp /tmp/50-raspap-router.conf /etc/lighttpd/conf-available/
sudo ln -s /etc/lighttpd/conf-available/50-raspap-router.conf /etc/lighttpd/conf-enabled/50-raspap-router.conf
sudo systemctl restart lighttpd.service
echo
echo "######################################"
read -p "Configure and setup software - press Enter to start"
cd /var/www/html
sudo cp installers/raspap.sudoers /etc/sudoers.d/090_raspap
sudo mkdir /etc/raspap/
sudo mkdir /etc/raspap/backups
sudo mkdir /etc/raspap/networking
sudo mkdir /etc/raspap/hostapd
sudo mkdir /etc/raspap/lighttpd
sudo mkdir /etc/raspap/system
sudo mkdir /etc/raspap/plugins
sudo chown -R www-data:www-data /var/www/html
sudo chown -R www-data:www-data /etc/raspap
sudo mv installers/enablelog.sh /etc/raspap/hostapd
sudo mv installers/disablelog.sh /etc/raspap/hostapd
sudo mv installers/servicestart.sh /etc/raspap/hostapd
sudo mv installers/debuglog.sh /etc/raspap/system
sudo mv installers/plugin_helper.sh /etc/raspap/plugins
sudo chown -c root:root /etc/raspap/hostapd/*.sh
sudo chown -c root:root /etc/raspap/system/*.sh
sudo chown -c root:root /etc/raspap/plugins/*.sh
sudo chmod 750 /etc/raspap/hostapd/*.sh
sudo chmod 750 /etc/raspap/system/*.sh
sudo chmod 750 /etc/raspap/plugins/*.sh
sudo cp installers/configport.sh /etc/raspap/lighttpd
sudo chown -c root:root /etc/raspap/lighttpd/*.sh
sudo mv installers/raspapd.service /lib/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable raspapd.service
echo
echo "######################################"
read -p "Install default configuration - press Enter to start"
sudo mv /etc/default/hostapd ~/default_hostapd.old
sudo cp /etc/hostapd/hostapd.conf ~/hostapd.conf.old
sudo cp config/hostapd.conf /etc/hostapd/hostapd.conf
sudo cp config/090_raspap.conf /etc/dnsmasq.d/090_raspap.conf
sudo cp config/090_wlan0.conf /etc/dnsmasq.d/090_wlan0.conf
sudo cp config/dhcpcd.conf /etc/dhcpcd.conf
sudo cp config/config.php /var/www/html/includes/
sudo cp config/defaults.json /etc/raspap/networking/
echo
echo "######################################"
read -p "Disable systemd-networkd - press Enter to start"
sudo systemctl stop systemd-networkd
sudo systemctl disable systemd-networkd
sudo cp config/raspap-bridge-br0.netdev /etc/systemd/network/raspap-bridge-br0.netdev
sudo cp config/raspap-br0-member-eth0.network /etc/systemd/network/raspap-br0-member-eth0.network
echo
echo "######################################"
read -p "ip4 forwarding and MASQ - press Enter to start"
echo "net.ipv4.ip_forward=1" | sudo tee /etc/sysctl.d/90_raspap.conf > /dev/null
sudo sysctl -p /etc/sysctl.d/90_raspap.conf
sudo /etc/init.d/procps restart
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -s 192.168.50.0/24 ! -d 192.168.50.0/24 -j MASQUERADE
sudo iptables-save | sudo tee /etc/iptables/rules.v4
echo
echo "######################################"
read -p "Start hostapd - press Enter to start"
sudo systemctl unmask hostapd.service
sudo systemctl enable hostapd.service
echo
echo "######################################"
read -p "Install OpenVPN - press Enter to start"
sudo apt-get install -y openvpn
sudo sed -i "s/\('RASPI_OPENVPN_ENABLED', \)false/\1true/g" /var/www/html/includes/config.php
sudo systemctl enable openvpn-client@client
echo
echo "######################################"
read -p "Install Wireguard - press Enter to start"
sudo apt-get install -y wireguard
sudo sed -i "s/\('RASPI_WIREGUARD_ENABLED', \)false/\1true/g" /var/www/html/includes/config.php
sudo systemctl enable wg-quick@wg
echo
echo "######################################"
read -p "Install adblock - press Enter to start"
sudo mkdir /etc/raspap/adblock
wget https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts -O /tmp/hostnames.txt
wget https://big.oisd.nl/dnsmasq -O /tmp/domains.txt
sudo cp /tmp/hostnames.txt /etc/raspap/adblock
sudo cp /tmp/domains.txt /etc/raspap/adblock
sudo cp installers/update_blocklist.sh /etc/raspap/adblock/
sudo chown -c root:www-data /etc/raspap/adblock/*.*
sudo chmod 750 /etc/raspap/adblock/*.sh
sudo touch /etc/dnsmasq.d/090_adblock.conf
echo "conf-file=/etc/raspap/adblock/domains.txt" | sudo tee -a /etc/dnsmasq.d/090_adblock.conf > /dev/null
echo "addn-hosts=/etc/raspap/adblock/hostnames.txt" | sudo tee -a /etc/dnsmasq.d/090_adblock.conf > /dev/null
sudo sed -i '/dhcp-option=6/d' /etc/dnsmasq.d/090_raspap.conf
sudo sed -i "s/\('RASPI_ADBLOCK_ENABLED', \)false/\1true/g" includes/config.php
echo
echo "######################################"
read -p "Stop and disable wpa_supplicant - press Enter to start"
sudo systemctl stop wpa_supplicant.service
sudo systemctl disable wpa_supplicant.service
sudo systemctl mask wpa_supplicant.service
echo
echo "######################################"
read -p "Stop NetworkManager managing wlan0 - press Enter to start"
echo "[keyfile]" | sudo tee -a /etc/NetworkManager/conf.d/99-unmanaged-devices.conf
echo "unmanaged-devices=interface-name:wlan0" | sudo tee -a /etc/NetworkManager/conf.d/99-unmanaged-devices.conf
echo
echo "######################################"
read -p "Rebooting - Good Luck!!! - press Enter to start"
sudo systemctl reboot
Post Installation - Notes
- Do change the default SSID password
- Do change the default admin password of the Web GUI
- Do install the kludge for the 2GB error in 1GB models
- Do configure the DNS servers in the Web GUI or clients may not get DNS server entries
## Other Stuff If you really want the Dashboard pictures to show the 2.4/5GHz, highlight the ethernet port and show number of wifi client connections, you’ll have to change the /var/www/html/src/RaspAP/UI/Dashboard.php file
- Edit the getConnectionType function include
end0[0-9]in the matching - Rewrite the getWirelessClients function to use
ip nto determine number of wireless clients- iw does not return the correct information for number of wireless clients
- Rewrite the getFrequencyBand function to look at hostapd.conf to determine the whether 2.4 or 5Ghz
- iw does not return the frequency used by the wifi
public function getConnectionType(): string
{
// get the interface associated with the default route
$interface = trim(shell_exec("ip route show default | head -1 | awk '{print $5}'"));
if (empty($interface)) {
return 'unknown';
}
// classify interface type
if (preg_match('/^eth0|enp\d+s\d+|ens\d+s\d+|end[0-9]|enx[0-9a-f]*/', $interface)) {
return 'ethernet';
}
if (preg_match('/^wlan\d+|wlp\d+s\d+|wlx[0-9a-f]*/', $interface)) {
return 'wireless';
}
if (preg_match('/^usb\d+|^eth[1-9]\d*/', $interface)) {
return 'tethering';
}
if (preg_match('/^ppp\d+|wwan\d+|wwp\d+s\d+/', $interface)) {
return 'cellular';
}
// if none match, return the interface name as a fallback
return "other ($interface)";
}
public function getWirelessClients($interface): int
{
$cmd = 'ip n | grep '. escapeshellarg($interface) .' | egrep \'DELAY|REACHABLE|PROBE\'';
exec($cmd, $output, $status);
if ($status !== 0) {
return 0;
}
// enumerate 'station' entries (each represents a wireless client)
$clientCount = 0;
foreach ($output as $line) {
$clientCount++;
}
return $clientCount;
}
public function getFrequencyBand(string $interface): ?string
{
$output = shell_exec("cat /etc/hostapd/hostapd.conf | grep channel= | awk 'BEGIN{FS=\"=\"}{ print $2 }'");
if (!$output) {
return null;
}
$frequency = (int)$output;
if ($frequency < 15 ) {
return "2.4";
}
return "5";
}
References
Manual installation steps on the RaspAP docs site
Notes on disabling WPA and excluding WLAN0
Additional library to install for RaspAP
Completely disable a service
