8

Problem

I downloaded the mongodb 3.0.7 tar files. Then I added the bin directory to my path:

export PATH=<mongodb-install-directory>/bin:$PATH

Then when I run the mongodb server:

mongod --fork --logpath "/home/me/mongolog" --dbpath "/home/me/data"

I get this error:

mongod: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory

What I did

I tried this solution. In brief I updated my openssl:

sudo apt-get update
sudo apt-get install libssl1.0.0 libssl-dev

and then:

cd /lib/x86_64-linux-gnu
sudo ln -s libssl.so.1.0.0 libssl.so.10
sudo ln -s libcrypto.so.1.0.0 libcrypto.so.10

but it says that it cannot find libssl.so.10 and libcrypto.so.10. I don't know what to do!

Community
  • 1
  • 1
Hadi
  • 4,160
  • 9
  • 42
  • 62
  • I don't have a (good) answer for you, but this happened to me today when I installed the latest version of Mongo on an old host (Cent 5). I worked around it by installing an older version that I knew to work. I suspect Mongo has introduced a dependency on a newer (maybe post-heartbleed?) version of Openssl. – Fopedush Nov 13 '15 at 19:52
  • @Fopedush Ohh you meant you installed an older version of mongo? I think it should have some approach for installing it! – Hadi Nov 14 '15 at 15:41
  • 1
    I agree, there _should_ be a straightforward way of installing the latest mongo on an older host. Unfortunately I don't know what that is. – Fopedush Nov 15 '15 at 18:24

6 Answers6

8
sudo apt-get purge mongodb-org*

Just start over from here.

If you don't want 3.2, do not

sudo apt-get install -y mongodb-org

Specify the version for all the individual components in the next step.

OR you can copy the correct version link from mongodb.

You will need to

cd /Downloads 
wget wget https://fastdl.mongodb.org/linux/mongodb-correct-version.tgz
tar -zxvf mongodb-correct-version.tgz 

You should see all the executables. Make sure /usr/local/bin is in your PATH

echo $PATH

Create a symbolic link for the mongod server and check the version.

sudo ln -s ~/Downloads/mongodb-correct-version/bin/mongod /usr/local/sbin/bin/mongod
mongod --version

Now create a symbolic link for the shell and check the version.

sudo ln -s ~/Downloads/mongodb-correct-version/bin/mongo /usr/local/bin/mongo
mongo --version

Create a directory path for the server.

mkdir ~/data
mkdir ~/data/db 

Start the server and let it run from a separate terminal than the shell.

mongod --dbpath ~/data/db/

It should be listening on port 27017. In a new terminal, start mongo.

mongo
  • I knew that. There is a limited access to internet for this server I'm working on. Thank you by the way. I've solved this solution but I couldn't find a time to write it here. I'll do it as soon as possible. – Hadi Dec 11 '15 at 13:15
  • 1
    I just added details. This is a common issue. – user2607479 Dec 11 '15 at 21:22
  • @Edward Sorry for late answer. Just follow this solution it have to work. – Hadi Feb 17 '16 at 10:32
6

Seems that mongo is expecting libssl files in /usr/lib/:

  sudo cp /lib/x86_64-linux-gnu/libssl.so.1.0.0 /usr/lib/libssl.so.10
  sudo cp /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.10
Dziamid
  • 10,081
  • 11
  • 62
  • 100
4

Check your server version, your system may be centos, but downloaded the ubuntu version of the mongodb. Download again just fine

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.10.tgz

曾田生
  • 53
  • 3
  • I've got that error on Centos 8 with `mongodb-linux-x86_64-rhel70-3.6.14.tgz`; plain Linux package `mongodb-linux-x86_64-3.6.14.tgz` worked fine. Previously I installed without any problem `mongodb-linux-x86_64-rhel70-3.4.9.tgz` on Centos 7. – Pino Nov 11 '19 at 10:22
1

I'm using MongoDB v3.4.6 on Ubuntu 14.04 LTS and have the same issue:

mongod: error while loading shared libraries: libnetsnmpmibs.so.30: cannot open shared object file: No such file or directory

To FIX it, I had to install snmp with apt-get:

$ sudo apt-get update
$ sudo apt-get install snmp

Hope this helps someone somewhere out there beneath the pale moonlight... <8,_,)-----

4Z4T4R
  • 1,954
  • 1
  • 23
  • 39
0

I had the same error, even after following instructions below. But my problem was solved when I tried sudo mongo

Sviatoslav Oleksiv
  • 1,723
  • 11
  • 11
  • This is probably because your `root` has a different environment paths. I don't think this would solve the problem in general. – Maxim Mai May 31 '16 at 17:40
0

i had this same problem and what i did was

  1. created /data/db in the root folder(i use a Linux distro)
  2. then, mongod --dbpath ~/data/db/
  3. then, mongo

i hope this helps anyone facing the same problem in future

regnex
  • 109
  • 1
  • 6