Here's a step-by-step guide to install Kiwix on a MoodleBox.
You should first log into the MoodleBox via SSH, begin a sudo
session and create needed folders:
sudo -Es
mkdir -p /opt/kiwix/bin/ /opt/kiwix/data/
Install Kiwix tools
cd /opt/kiwix/bin/
wget -c https://download.kiwix.org/release/kiwix-tools/kiwix-tools_linux-armhf-3.2.0-1.tar.gz
tar -xzf kiwix-tools_linux-armhf-3.2.0-1.tar.gz --strip-components=1
Get ZIM files
If you want to serve big ZIM files, buy a big microSD card or use an external drive. Obviously choose the adequate ZIM file names.
cd /opt/kiwix/data/
wget -c https://download.kiwix.org/zim/wikipedia/wikipedia_fr_all_mini_2022-01.zim
wget -c β¦
Create Kiwix library
/opt/kiwix/bin/kiwix-manage /opt/kiwix/data/kiwixlib.xml \
add /opt/kiwix/data/wikipedia_fr_all_mini_2022-01.zim
Configure nginx
as a proxy to serve Kiwix content and restart nginx
cat > /etc/nginx/sites-available/kiwix.conf <<EOF
server {
server_name kiwix.moodlebox.home;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host \$host;
proxy_set_header Port \$server_port;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Real-Ip \$remote_addr;
proxy_redirect off;
}
}
EOF
ln -s /etc/nginx/sites-available/kiwix.conf /etc/nginx/sites-enabled/kiwix.conf
systemctl restart nginx.service
Create a service file and enable it to launch Kiwix web server at startup
cat > /etc/systemd/system/kiwix.service <<EOF
[Unit]
Description=Kiwix web server.
After=network.target
[Service]
Type=forking
ExecStart=/opt/kiwix/bin/kiwix-serve --port 8080 --daemon --library /opt/kiwix/data/kiwixlib.xml
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable kiwix.service
Reboot
reboot
You can now visit http://kiwix.moodlebox.home from a device connected to the MoodleBox access point. Enjoy!