I want to install mongodb 3.4 on debian stretch. Unfortunately debian stretch packages are only mongodb 3.2 (https://packages.debian.org/stretch/mongodb).

The mongodb docs only mentions debian 7 and 8 (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/). When using debian 8 commands I can't install mongodb packages because they have unmet dependencies.

When allowing jessie-backports the unmet dependencies error is gone but I am unsure if I should do this and install jessie-backports packages in stretch.

How would you install mongodb 3.4 on debian stretch?

Thanks for any advice.

  • they released 3.6 for stretch – eri Jun 27 '18 at 11:26

The error when you attempt to use the Debian 8 instructions suggests lots of missing dependencies, but in fact will work if you install the single actual missing dependency (libssl1.0.0). For reference, to work out what was missing, I downloaded the mongod binary and had a look at ldd:

adam@debian9:~/mongo/mongodb-linux-x86_64-debian81-3.4.6/bin$ ldd mongod
    linux-vdso.so.1 (0x00007ffd0e15d000)
    libssl.so.1.0.0 => not found
    libcrypto.so.1.0.0 => not found
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f93c6dff000)

If you have a look at what is installed in Debian 9, basically we just have versions of libssl that are too new. The libssl and libcrypto libraries are both installed by the libssl package and it is pretty much standalone. Hence, we can just grab the Debian 8 libssl1.0.0 package and install that.

The amd64 version of the package can be found here (just Google for libssl1.0.0 Jesse and your arch for another version).

To install that package, download the file (in my case it was to Downloads) and then install it with dpkg:

adam@debian9:~$ sudo dpkg -i /home/adam/Downloads/libssl1.0.0_1.0.1t-1+deb8u6_amd64.deb 
Selecting previously unselected package libssl1.0.0:amd64.
(Reading database ... 126471 files and directories currently installed.)
Preparing to unpack .../libssl1.0.0_1.0.1t-1+deb8u6_amd64.deb ...
Unpacking libssl1.0.0:amd64 (1.0.1t-1+deb8u6) ...
Setting up libssl1.0.0:amd64 (1.0.1t-1+deb8u6) ...

With that complete we quickly re-check ldd:

adam@debian9:~/mongo/mongodb-linux-x86_64-debian81-3.4.6/bin$ ldd mongod
    linux-vdso.so.1 (0x00007ffdf25de000)
    libssl.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f86bc12d000)
    libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f86bbd31000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f86bbb29000)

Success! Now let's retry the package installation of mongodb-org:

adam@debian9:~$ sudo apt install mongodb-org
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
  mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 66.8 MB of archives.
After this operation, 270 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org-shell amd64 3.4.6 [7,980 kB]
Get:2 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org-server amd64 3.4.6 [14.2 MB]
Get:3 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org-mongos amd64 3.4.6 [8,103 kB]
Get:4 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org-tools amd64 3.4.6 [36.5 MB]
Get:5 http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4/main amd64 mongodb-org amd64 3.4.6 [3,820 B]
Fetched 66.8 MB in 7s (9,509 kB/s)                                                             
Selecting previously unselected package mongodb-org-shell.
(Reading database ... 126491 files and directories currently installed.)
Preparing to unpack .../mongodb-org-shell_3.4.6_amd64.deb ...
Unpacking mongodb-org-shell (3.4.6) ...
Selecting previously unselected package mongodb-org-server.
Preparing to unpack .../mongodb-org-server_3.4.6_amd64.deb ...
Unpacking mongodb-org-server (3.4.6) ...
Adding system user `mongodb' (UID 119) ...
Adding new user `mongodb' (UID 119) with group `nogroup' ...
Not creating home directory `/home/mongodb'.
Adding group `mongodb' (GID 123) ...
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Setting up mongodb-org (3.4.6) ...

Finally, let's make sure the service starts and we can connect with a shell:

adam@debian9:~$ sudo systemctl start mongod
adam@debian9:~$ mongo
MongoDB shell version v3.4.6
connecting to: mongodb://
MongoDB server version: 3.4.6 

And there you have it - Jesse packages working on Stretch. I'm sure that there will be an official release soon that will make this obsolete, but in the meantime this is a relatively painless workaround.

  • Thanks for the backports trick. I was getting package not found for mongodb-org when it dawned upon me I had the wrong bitiness of Linux. Got myself a 32 bit VM instead of 64 bit... oops! MongoDB instructions and binaries are for 64 bit only! – sumitkm Aug 23 '17 at 7:55
  • 2
    that's been the case for a long time, 32 bit had severe limitations (2GB max data), particularly in the MMAP storage engine, not sure WiredTiger ever supported it – Adam C Aug 23 '17 at 16:15
  • 3
    found it - dropped support for 32-bit with version 3.0: docs.mongodb.com/manual/release-notes/3.0-compatibility/… – Adam C Aug 23 '17 at 16:18
  • 1
    Thanks for this Adam. In the final step I would use sudo systemctl start mongod since SystemD is the default init system for Debian since Jessie and service became just a compatibility script. – Rafa Aug 24 '17 at 18:26
  • 1

It appears that mongodb 3.4 doesn't yet have binaries for debian stretch in their official apt repository. Your best approach may be building from source for your system.

There are specific instructions on this page: https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source

You could also attempt to use the Ubuntu packages for Xenial, but there is no guarantee that this would work properly, and I think building from source would be a better idea.

  • I tried to build it from source but I get SSLv2_method has not been declared errors from asio/ssl/impl/context.ipp. Any ideas? – Hamburml Jul 16 '17 at 17:41

I just had this problem (though using debain 9).

A bit of digging revealed that it was due to the fact that the older debian-packaged version could not be removed by the installer (i was attempting to upgrade from unofficial mongodb package provided by Debian to the official mongodb-org packages).

The solution was the following:

sudo apt-get autoremove mongodb-org
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install -y mongodb-org

Hope this saves someone some time!


I created a Github repository to make it easy to build the latest version of MongoDB things yourself. It will build everything internally instead of depending on apt, including the systemd service.


As of now, the package is available within Debian -


Just install it by running

# sudo apt install mongodb-server

  • 2
    It's not 3.4 but 3.2 – smonff Apr 17 '18 at 8:08

I'm using Debian 9 Stretch

I downloaded this version of MongoDB: Linux 64-bit legacy 64x

enter image description here

I downloaded to my desktop folder, and renamed it to mongodb

After that, you "need" to move your recent renamed folder to /opt/

mv mongodb /opt/

Now you can access /opt/mongodb/bin and exec a command like that:

./mongod --dbpath ./db/

To make the thing fun, you could create a symlink, for example, mongod to /usr/local/bin/, like that:

ln -s /opt/mongodb/bin/mongod /usr/local/bin/mongod

Now, in your terminal type the command, from anywhere:

mongod --dbpath /homer/user/Desktop/db

You need to specify the --dbpath in order to the mongod work properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.