How to build kiwix for Debian Wheezy (Debian Testing)

Few weeks ago I bought a new netbook.  I wanted it to serve also as my encyclopedia.  The solution is to install on it offline Wikipedia.

Inbar Hovav explained, in her Hebrew language blog, how to accomplish this using kiwix.

לפני כמה שבועות רכשתי נטבוק חדש.  רציתי שזה ישמש אותי גם כאנציקלופדיה.  הפתרון הוא להתקין עליו גירסא לא מקוונת של הויקיפדיה.

ענבר חובב הסבירה בבלוג שלה איך לבצע זאת תוך שימוש ב-kiwix.

Unfortunately, kiwix was built for Ubuntu but not for Debian.  I downloaded the source code and found that it contains the Debian control files needed to build a .deb from it.  Nice, except for a problem: it declared dependencies upon package versions, which exist in Ubuntu but not in Debian.

I solved the problem by editing the debian/control and debian/changelog files, installing dependencies which exist in Debian Wheezy and building the package (using dpkg-buildpackage -us -uc).

To save you some work, I created a diff file which shows what I changed:
diff -r kiwix-0.9/debian/changelog kiwix-0.9.patched/debian/changelog
1c1,13
< kiwix (0.9-alpha7.1) maverick; urgency=low
---
> kiwix (0.9-alpha7.1oz2) wheezy; urgency=low
>
>   * Changed to depend upon libxapian22 instead of libxapian15
>
>  -- Omer Zak <w1@zak.co.il>  Wed, 29 Jun 2011 06:50:00 +0300
>
> kiwix (0.9-alpha7.1oz1) wheezy; urgency=low
>
>   * Same code as 0.9-alpha7, simply change debian/control and rebuild.
>
>  -- Omer Zak <w1@zak.co.il>  Wed, 29 Jun 2011 06:04:04 +0300
>
> kkiwix (0.9-alpha7.1) maverick; urgency=low
diff -r kiwix-0.9/debian/control kiwix-0.9.patched/debian/control
12c12
<     xulrunner-1.9.2-dev,
---
>     xulrunner-dev,
26,27c26,27
<      libicu42,
<      libxapian15,
---
>      libicu44,
>      libxapian22,
30c30
<      xulrunner-1.9.2,
---
>      xulrunner-1.9.1,
54c54
<  * Tabs navigation
\ No newline at end of file
---
>  * Tabs navigation

The full sequence of steps is as follows.

If you are not using Debian Wheezy, you’ll have to modify some details below.

  1. Download kiwix-0.9-alpha7-src.tar.bz2.
  2. tar jxvf kiwix-0.9-alpha7-src.tar.bz2
  3. cd kiwix-0.9 and modify two files as described above
  4. Install any missing packages you need for building and installing.  The debian/control file lists the packages you need.
  5. Build the .deb file by:  dpkg-buildpackage -us -uc
  6. You’ll find the .deb file in the parent directory of kiwix-0.9 under the name: kiwix_0.9-alpha7.1oz_ARCH.deb where ARCH is the name of the architecture under which you built it.

Now, become root and do:

  1. cd ..
  2. dpkg –install kiwix_0.9-alpha7.1oz_ARCH.deb
  3. cd /usr/local/bin
  4. ln -s /usr/bin/xulrunner-1.9.1 xulrunner

The next step is to become again a regular user and download the *.zim files that you want and open them inside kiwix.  Please be prepared to wait patiently while kiwix indexes the files when you open them for the first time.

Author: Omer Zak

I am deaf since birth. I played with big computers which eat punched cards and spew out printouts since age 12. Ever since they became available, I work and play with desktop size computers which eat keyboard keypresses and spew out display pixels. Among other things, I developed software which helped the deaf in Israel use the telephone network, by means of home computers equipped with modems. Several years later, I developed Hebrew localizations for some cellular phones, which helped the deaf in Israel utilize the cellular phone networks. I am interested in entrepreneurship, Science Fiction and making the world more accessible to people with disabilities.

One thought on “How to build kiwix for Debian Wheezy (Debian Testing)”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.