Building MongoDB for Debian Jessie

Today Debian Jessie doesn’t have a recent version of MongoDb. They provide 2.4.10 when I (and you if you arrived here) need something newer like 3.0.6. On MongoDB website, you can download Debian packages but only for the already old Wheezy…

So you will need to download the MongoDB 3.0.6 tgz source file here and try to build the .deb on your own. That’s how I did it:

First, I’ve Installed this list of debian packages:

apt-get install debtools devscripts gcc libboost-date-time-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libgoogle-perftools-dev libpcap-dev libpcre3-dev libreadline-dev libsnappy-dev libstemmer-dev libssl-dev libv8-dev python-pymongo scons dh-systemd

Once you’ve untar the archive, go to the debian/ directory and add thoses links:

ln -s mongodb-org-unstable.control control
ln -s mongodb-org-unstable.rules rules

In the control file change the first line from “Source: mongodb-org-unstable” to “Source: mongodb”.

In the rules files, uncomment each commented scons command, especially in the build-stamp part. I’ve changed it to “scons -j12 all” to build it with 12 parallel gcc process (depends how many cores your CPUs have).

Still in the debian/ directory, In the changelog file add thoses lines at the beginning:

mongodb (3.0.6) unstable; urgency=low

  * Rebuild debian package for Jessie

 -- Aurelien Beaujean <aure@dagobah.eu.org> Thu, 08 Oct 2015 12:02:36 +0200

Then you are ready to build MongoDB by running the command “dpkg-buildpackage -rfakeroot” in the mongodb-src-r3.0.6 directory. It takes a while, for me it took about 15 minutes. And if everything gone good, you shoud get .deb files in the upper directory to give to install to dpkg.

Feel free to comment on this article if you solved some issues I didn’t had while building.

One thought on “Building MongoDB for Debian Jessie

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>