I am trying to install MongoDB
from Zip Folder Downloaded From MongoDB
site (https://www.mongodb.com/download-center/enterprise/releases/development)
I configured log path, data path correctly and trying to start mongod
and getting following dependency error.
amran:~$ mongod
mongod: /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by mongod)
libcurl.so.4
exists in my machine
amran:~$ locate libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so.4.5.0
How to fix this issue. Any Idea Please!
You have to do some custom things in order to run MongoDB 4.0 in Ubuntu 18.10.
sudo apt-get install libcurl3
locate libcurl3 file likely in /usr/lib/x86_64-linux-gnu/
make an LD_LIBRARY folder in home.
cp /usr/lib/x86_64-linux-gnu/libcurl.so.4 /home/user/LD_LIBRARY
mv /home/user/LD_LIBRARY/libcurl.so.4 /home/user/LD_LIBRARY/libcurl.so.3
make a link of libcurl3 by :
ln -s libcurl.so.3 libcurl.so.4
echo "export LD_LIBRARY_PATH=~/LD_LIBRARY/:$LD_LIBRARY_PATH" >> ~/.bashrc
source ~/.bashrc
now start MongoDB it will run.
Also now you can install
sudo apt-get install libcurl4 php-curl
And use all the application require php-curl and libcurl4
The problem is that this binary MongoDB distribution needs an older version of libcurl. In the other answers, the system is modified by globally installing an older version of libcurl, I strongly recommend against doing this as it will uninstall and/or break anything else that depends on the newer version.
Instead download a copy of the older library, extract the required binary, and preload it when running the mongod binary. This way you don't change anything else on the system, and as an added bonus you don't need root privileges to do it. Here's how:
First create a temporary directory, download the deb package and extract the file:
me@server:~$ mkdir tmp
me@server:~$ cd tmp
me@server:~/tmp$ apt download libcurl3
Get:1 http://gb.archive.ubuntu.com/ubuntu bionic/universe amd64 libcurl3 amd64 7.58.0-2ubuntu2 [214 kB]
Fetched 214 kB in 0s (9,969 kB/s)
me@server:~/tmp$ ar x libcurl3_7.58.0-2ubuntu2_amd64.deb
me@server:~/tmp$ tar xf data.tar.xz
Now copy the library to where your mongod binary is:
me@server:~/tmp$ cp usr/lib/x86_64-linux-gnu/libcurl.so.4.5.0 ~/mongodb/mongodb-linux-x86_64-debian92-4.2.2-39-g38e05a1/bin/
You can make a wrapper for mongod so it preloads the required version of libcurl:
me@server:~/tmp$ cd ~/mongodb/mongodb-linux-x86_64-debian92-4.2.2-39-g38e05a1/bin/
me@server:~/mongodb/mongodb-linux-x86_64-debian92-4.2.2-39-g38e05a1/bin$ mv mongod mongod.real
me@server:~/mongodb/mongodb-linux-x86_64-debian92-4.2.2-39-g38e05a1/bin$ cat > mongod
#!/bin/sh
DIR="$(cd "$(dirname "$0")" && pwd)"
LD_PRELOAD=$DIR/libcurl.so.4.5.0 exec $DIR/mongod.bin $*
me@server:~/mongodb/mongodb-linux-x86_64-debian92-4.2.2-39-g38e05a1/bin$ chmod 755 mongod
Now you can run mongod and it will work. Importantly you didn't make any changes to the installed packages on the system, and you don't need to use sudo for this to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With