Offline Wikipedia Wireless Access Point on a Raspberry Pi using Kiwix

Update system
sudo apt update && sudo apt upgrade
Modify these Settings to Suit
sudo raspi-config

Localisation Options > Change Locale

Localisation Options > Change Timezone

Localisation Options > Change Keyboard Layout

Localization Options > Change Wi-fi Country

Download Kiwix Server

https://www.kiwix.org/en/downloads/kiwix-serve/

Copy link for GNU/Linux ARM (32bits)

wget (paste in url)
Decompress Kiwix Server
tar -zxvf kiwix-tools_linux-armhf.tar.gz
Install Kiwix Binaries
sudo mv kiwix-tools_linux-armhf-3.0.3/* /usr/local/bin/
Download Zim File

https://wiki.kiwix.org/wiki/Content_in_all_languages

Copy to server using scp

Copy to /var/local/
sudo mv wikipedia_en_simple_all_nopic_2020-02.zim /var/local/
Create Kiwix Service
sudo nano /etc/systemd/system/kiwix.service

Paste this in file:

[Unit]
Description=Kiwix Service
After=network.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/bin/kiwix-serve /var/local/wikipedia_en_simple_all_nopic_2020-02.zim -p 80
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

Control-o to save and control-x to exit (use this to exit and save nano)

Enable and Start Kiwix Service
sudo systemctl enable kiwix
sudo systemctl start kiwix
Assign Static IP to wlan0
sudo nano /etc/dhcpcd.conf
interface wlan0
     static ip_address=192.168.1.1/24
     nohook wpa_supplicant
Commit Changes to dhcpcd
sudo systemctl daemon-reload
sudo systemctl restart dhcpcd
Install dnsmasq (DNS and DHCP Server)
sudo apt install dnsmasq
Make Backup of dnsmasq.conf
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
Edit dnsmasq.conf
sudo nano /etc/dnsmasq.conf
interface=wlan0
dhcp-range=192.168.1.2,192.168.1.254,255.255.255.0,24h
address=/#/192.168.1.1
Install hostapd (WiFi Access Point Software)
sudo apt install hostapd
Edit hostapd.conf
sudo nano /etc/hostapd/hostapd.conf
Config for Password Protected WiFi Access Point
interface=wlan0
driver=nl80211
ssid=kiwix
hw_mode=g
channel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=password
Config for Open WiFi Access Point
interface=wlan0
driver=nl80211
ssid=kiwix
hw_mode=g
channel=6
Additional Online Resources for WiFi Setup

https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md

https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf

Enable WiFi Setup
sudo nano /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Commit Changes to hostapd and dnsmasq
sudo systemctl daemon-reload
sudo systemctl unmask hostapd
sudo systemctl enable hostapd dnsmasq
sudo systemctl start hostapd dnsmasq
Enable Read Only System (Optional)
sudo raspi-config

Advanced Options > Overlay FS

Choose “Yes” to enable overlay file system and/or “Yes” to write protect boot partition.

Leave a comment

Your email address will not be published. Required fields are marked *