Introduction
Are you looking for an easy way to set up a Kiwix server on your local network? With Docker Compose and the open-source project, Kiwix, you can have your library of educational content within minutes! The following article will provide you with step-by-step instructions on how to use Docker Compose to quickly get your very own Kiwix server up and running in no time.
What is Kiwix?
Kiwix is an open-source project that provides a library of educational content. It was started in 2008 and has since been used to provide libraries of information in areas with limited internet access.
Kiwix can host a wide variety of content, including books, articles from Wikipedia and other educational websites, videos, audio files, software applications, and more. All content is stored in a local library that is accessible with the open-source Kiwix desktop application or through the web-based Kiwix server.
Prerequisites
To successfully set up a Kiwix server using Docker Compose, there are a few key components that must be available:
- A computer with Docker installed
- Access to the internet
Setting Up the Server with Docker Compose
Once you have all the necessary prerequisites, you can begin setting up your Kiwix server using Docker Compose in these simple steps:
1. Create a directory where you want to store your Kiwix data, for example:
mkdir -p /srv/kiwix/data
2. Add a docker-compose.yml
file in/srv/kiwix
and paste in:
services:
kiwix:
image: kiwix/kiwix-serve
container_name: kiwix
ports:
- 8000:8080
volumes:
- /srv/kiwix/data:/data
command: "*.zim"
restart: unless-stopped
You can change port 8000
to whatever you'd like in range: 1024 - 49151.
3. Download libraries of your choice from Kiwix Library.
Then a modal window should open in the middle. Right click on "Direct" and click "Copy Link Address"
Then, you can go to your /srv/kiwix/data
directory and type in:
wget https://download.kiwix.org/zim/wikipedia/wikipedia_en_all_maxi_2023-02.zim
This will download the library in ZIM format, once it's finished downloading, start up your Kiwix server by typing in: docker compose up -d
You can preview logs by typing in: docker compose logs -f
hydra@hydra:/srv/kiwix$ docker compose logs -f
kiwix | /usr/local/bin/kiwix-serve --port=8080 gardening.stackexchange.com_en_all_2022-11.zim serverfault.com_en_all_2022-11.zim superuser.com_en_all_2022-11.zim urban-prepper_en_all_2023-02.zim wikihow_en_maxi_2022-12.zim wikipedia_en_all_nopic_2022-01.zim wikipedia_pl_all_maxi_2023-02.zim wiktionary_pl_all_maxi_2023-01.zim
kiwix | The Kiwix server is running and can be accessed in the local network at: http://172.28.0.2:8080
You can find out your server's IP address by typing in ifconfig
.
Accessing Kiwix server outside LAN
To get to your Kiwix server from outside your home network, you need to set up port forwarding on your router. That will let people from the internet come to your computer that has Kiwix. You can use a DynDNS service so you don't have to remember the IP address.
If you can't do port forwarding because it's not allowed, or if you're using a 4G (LTE) / 5G network, then you can use SSH port forwarding instead and be able to access the server from anywhere in the world!
Adding HTTPS to Kiwix
Serve your Kiwix server with an added layer of security by adding an SSL certificate. This can be done by setting up Nginx as a reverse proxy for the Kiwix server, which will allow the connection to be secured and encrypted through HTTPS.
Summary
Setting up a Kiwix server with Docker Compose is an easy process. With the prerequisites in place, and by following the instructions provided in this article, you can have your very own library of educational content set up within minutes! Now, all that's left to do is start exploring the world of knowledge available to you! Enjoy!