Self Host Your Own Copy of Wikipedia and More

Did you know you can self host your own copy of Wikipedia? You can along with many other Wikis that are available. 📰

Self Host Your Own Copy of Wikipedia and More

Kiwix Serve is a .zim compatible web server. It allows you to deliver .zim files over the HTTP protocol within your local network – be it a University or your own house. Simply start Kiwix-Serve on your machine, and your content will be available for anybody through their web browser.

What is Kiwix-Serve?

Kiwix-Serve is an offline reader – meaning that it allows you to browse text or video that is normally only available on the internet. We can take various online contents (such as Wikipedia, for example) and turn them into ZIM files, and these can be opened by Kiwix even if you have no connectivity.

The main advantage is its high compression rate. For instance, the entirety of Wikipedia (more than 6 million articles, with images) can fit in 89Gb. The Gutenberg Library’s 60,000 books will fit on 60 Gb of storage space. Pretty awesome!

Setup the Data directory for Kiwix

mkdir /docker/kiwixserve to give your ZIM files a place to live.

cd /docker/kiwixserve then using wget, download the ZIM file into the directory before deploying the container.

An example would be:


Install Kiwix Serve using Docker

docker run -v /docker/kiwixserve:/data -p 8080:80 -d kiwix/kiwix-serve *

The asterisk at the end of the Docker run command tells the script to search for all ZIM files in the data directory, so it is important to keep it there. Make sure your volume matches that of where the Zim files are located or the container will not start.

Enjoy your Wiki Content

What do mini, nopic and maxi mean in the Wikipedia ZIM files?

File size is always an issue when downloading such big content, so Kiwix produces each Wikipedia file in three flavors:

  • Mini: only the introduction of each article, plus the infobox. Saves about 95% of space vs. the full version.
  • nopic: full articles, but no images. About 75% smaller than the full version
  • Maxi: the default full version.

There is also a desktop app for both Windows and Linux called Kiwix JS Electron.

Pause wget Download

If you find yourself in a situation where you’re downloading a large file and need to shutdown your computer during the download for whatever reason, no problem, you can pause the download.

In the terminal window that is downloading your file just hit ctrl + C on your keyboard. This will stop the download and then you can shutdown your computer if you need.

Resume wget Download

To resume a wget download it’s very straight forward. Open the terminal to the directory where you were downloading your file to and run wget with the -c flag to resume the download. wget -c

Final Notes and Thoughts

Kiwix is a fun way to harness tons of information in a very small form factor. I have the full Wikipedia on my laptop running locally in Docker. If I ever lose power, no big deal since it all runs locally. I now have a portable Wikipedia I can access any time, anywhere I go with or without internet.