Self-hosted offline Wikipedia
Institutions of truth and knowledge are under attack as Bigtech continues to simp to fascism. And they are setting the stage for the mass erasure of identities, bodies, and history accuracies. And of course, they started with trans people
With Elon Musk leading the so-called Department of Government Efficiency, he will surely defund programs that support public education and archival services. History has shown how highly effective this is in subverting the ruling ideologies. Eerily similar, if not the same, with the tactics used by the Nazis who burned books and silenced scholars who contradicted their preferred narrative of Aryan supremacy.
Now more than ever, we need preserve knowledge and the truth, digital or otherwise. In that same vein, we also need to recognise the fragility of the platforms were using especially under the pressures of external censorship and manipulation. This is why I decided to self-host Wikipedia. With this, I am joining thousands of other people who are running their personal initiative towards digital resilience. How little these efforts may be, we are showing how much individual action helps in the collective struggle to protect public knowledge and truth. And you can, too.
I am self-hosting Wikipedia offline using KIWIX. KIWIX is a free software that allows users to access digital content offline. They have a noble goal of brining knowledge to 3 billion people who cannot access the Internet either because of money or censorship.
Wikipedia is just one of the many things you can self-host. Given its flexibility, you can also choose different ways to install it on your local device. It has a native client that works on Android, Windows, and even Raspberry Pi. Because I want to run KIWIX on my NAS, I will not be using any of these. Instead, I have opted to choose the easiest path, which is running it using a Docker image. This tutorial assumes that you already have Docker installed in your device. If not, please run these commands on your cli:
curl -sSL https://get.docker.com | sh
sudo usermod -aG docker $(whoami)
The second command adds your user to the Docker group.
Step 1: Create a directory where you will put the .zim files
mkdir kiwix
is the quickest way to do this. This will create a folder in your home directory called kiwix. Move into the directory you made via cd kiwix
. This is where you need to put the .zim files and the docker compose file you will be creating later on.
Step 2. Download the .zim files from Kiwix Library
I wrote a short python script to help download file. The script can list the latest uploads for a given category and it can also download the specific file. You can find it on my codeberg page . There are instructions there on how to use it, but basically you just clone the repo and run it locally in your device.
Or you can just go to the KIWIX library. It offers hundreds of available wikis and projects that you can host. Go to the KIWIX library, pick your poison and click the download button. Once downloaded, move the file/s to the kiwix folder you made previously.
**Step 3. Create a docker compose file
**
Using your the IDE of your choice, you can create a docker compose.yml file. Or, simply run nano docker-compose.yml
and paste the following codes:
services:
kiwix-serve:
image: ghcr.io/kiwix/kiwix-serve:3.7.0
volumes:
- ./kiwix:/data
ports:
- '9081:8080' # I already have something listening on port 8080, but you can run that as the default.
command: '*.zim' #or file names of the .zim you want to use
Let me walk you through what some of these chunks of code means. The most important here is the image
because this is what tells Docker Compose which image to use for the kiwix-serve
service. In this case, it’s pulling version 3.7.0 of the kiwix/kiwix-serve image from GitHub's Container Registry (ghcr.io).
command: '*.zim'
by default tells Kiwix to serve any ZIM file found in the /data directory. If you downloaded twenty .zim files and only want to run one. You have to specify that here by putting the file name of that specific zim file.
Step 4: Run docker compose up
Run the command docker compose up or use the detached mode docker compose up -d
on your cli. It will return these results.
You can see that the server is running on the local IP address 172.22.0.2:8080. If you want to access it from another device on your network, you'll need to find out the IP address of your server. You can do this by running the command ip a
in the terminal of where your server is hosted.
Remember that I used 9081:8080 in the port section of my docker compose
? 9081 (left side) is the port number in my host machine. So when you want to access the Kiwix service, you will use the host's IP address followed by this port number. 8080 (right side) is the port number that the Kiwix server within the Docker container is set to listen on.
Once you know the server's IP address, use it to connect from other devices. In my case, I use port 9081, so I connect using the server's IP followed by :9081.
If you don't have anything listening on 8080, just use that. YMMV
Step 5. Use KIWIX
The landing page will show you all the .zim files you downloaded. If you downloaded Wikipedia, it will show up here. You can then click it and surf away. I can now read Dante Alighieri’s bio alongside a synopsis of Divina Commedia.
And that's it. It's a very quick install. I have yet to decide what else to download at this point, but I am happy to be hosting my own local version of Wikipedia.
The world has always been a cruel place, but recent events on the other side of the Pacific illustrates us the flaws and inconsistencies of capitalism. The addiction to market deregulation, privatisation, and the reduction of state influence in the economy which started after WW2 paved the way for authoritarian tendencies to take root and flourish. If there's anything, we millenials and GenZ need to understand, it is the fact that a neoliberal capitalist framework not only fosters inequality but also creates fertile ground for authoritarianism to emerge and thrive.
Fascism is capitalism's ultimate form. Fascism is indeed capitalism in decay.
And during these times, hosting independent archives like Wikipedia locally becomes a radical act of preserving knowledge and safeguarding truth in times when both are under severe threat.
Ciao for now.