Skip to main content

How to consult and create a local version of wikipedia (and more)

With a smartphone

Install Kiwix application on Android 

kiwixlogo.png

 

With a web browser and a (mini) server

Install Kiwix on a Raspberry Pi !

If you change the hostname of the server (here altranet), then you can consult wikipedia (and what you add to kiwx library) with a web browser at http://altranet.local

kiwix-altranet_local.png

Prerequisites

Before starting, make sure:

  1. You have a Raspberry Pi with Raspberry Pi OS installed.
  2. You have an active internet connection.
  3. You are logged in as a user with sudo privileges.
  4. My user is admin, if yours is different please change it in the below scrips.

Installation Steps

Step 1: Update and Upgrade Your System

First, ensure your system is up to date:

sudo apt update -y && sudo apt upgrade -y

Step 2: Install Kiwix Tools

Install the Kiwix Tools package:

sudo apt install kiwix-tools -y


Setting Up the Kiwix Library

Step 3: Create a Library File

  • Create a directory to store your library:

    sudo mkdir /home/admin/kiwix-library

Create an empty library.xml file:

sudo touch /home/admin/kiwix-library/library.xml

Open the file for editing:

sudo nano /home/admin/kiwix-library/library.xml

Add the following content and save the file:

<?xml version="1.0" encoding="UTF-8"?>
<library xmlns="http://www.kiwix.org/">
</library>

Step 4: Download a Sample Book

Download a sample ZIM file to your library directory:

sudo wget -O /home/admin/kiwix-library/archlinux_en_all_nopic_2022-12.zim https://download.kiwix.org/zim/other/archlinux_en_all_nopic_2022-12.zim

Step 5: Add the Book to Your Library

Add the downloaded ZIM file to your library.xml file:

sudo kiwix-manage /home/admin/kiwix-library/library.xml add /home/admin/kiwix-library/archlinux_en_all_nopic_2022-12.zim -u https://download.kiwix.org/zim/other/archlinux_en_all_nopic_2022-12.zim


Starting the Kiwix Server

Start the Kiwix server on port 80 using your library file:

sudo kiwix-serve --port=80 --library /home/admin/kiwix-library/library.xml

You can now access the Kiwix server by navigating to your Raspberry Pi's IP address in a web browser.


Optional

To start Kiwix on port 80 after boot up:

sudo nano /etc/systemd/system/kiwix.service

Add the following:

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

[Service]
ExecStart=sudo /usr/bin/kiwix-serve --port=80 --library /home/admin/kiwix-library/library.xml
WorkingDirectory=/home/admin/kiwix-library
User=admin
Group=admin
Environment=DISPLAY=:0
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target


Finally, run the following:

sudo systemctl daemon-reload
sudo systemctl enable kiwix.service
sudo systemctl start kiwix.service
sudo systemctl status kiwix.service

Ressources on-line

    Kiwix main web site Kiwix library Kiwix-Raspberry-Pi how to install