Chapter 13:

WIKIPEDIA SERVER

Create a Wikipedia Server for Your Customers

Enhance your customer's experience by offering them access to Wikipedia via Wi-Fi. Follow these steps to set up your Wikipedia server:

  1. Download the Kiwix tools and server software by running the following commands in your terminal:

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

    tar -zxvf kiwix-tools_linux-armhf.tar.gz

    sudo mv kiwix-tools_linux-armhf-3.0.3/* /usr/local/bin/

  2. Obtain the ZIM files from the following link: https://wiki.kiwix.org/wiki/Content_in_all_languages

  3. Move the downloaded ZIM file (e.g., wikipedia_en_simple_all_nopic_2020-02.zim) to your local directory:

    sudo mv wikipedia_en_simple_all_nopic_2020-02.zim /var/local/

  4. Create a systemd service file for Kiwix by running:

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

  5. Add the following content to the kiwix.service 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

  6. If you have multiple libraries, modify the ExecStart line as follows:

    ExecStart=/usr/local/bin/kiwix-serve -mb /var/... (for a local library) /media/pi/... (for a USB-stored one)

  7. Enable and start the Kiwix service with these commands:

    sudo systemctl enable kiwix

    sudo systemctl start kiwix

  8. To make it accessible via Wi-Fi, include a link to the IP and port of the Kiwix service in your PHP file like this:

    <?php header("Location: http://10.1.1.1:9090"); exit; ?>

For more details, you can refer to the source: https://www.rickmakes.com/offline-wikipedia-on-wired-raspberry-pi-using-kiwix/