libcurl - linux

Use libcurl3 while having libcurl4 installed

Ever find yourself with this error? (or something similar)
    mongo: /usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by mongo)

1. Run these commands to download the libcurl.so.3 binary:

# Create a temporary libcurl3 directory in your home path and go there
mkdir ~/libcurl3 && cd ~/libcurl3
# Download the libcurl3 package to the newly created folder
apt-get download -o=dir::cache=~/libcurl3 libcurl3
# Extract a file named data.tar.xz from that package archive
ar x libcurl3* data.tar.xz
# Extract the data.tar.xz file to the current folder
tar xf data.tar.xz
# Copy the referenced file of the libcurl.so.4 symlink to /usr/lib/libcurl.so.3 (don't mind the .4 suffix, as noted it is actually version 3)
cp -L ~/libcurl3/usr/lib/x86_64-linux-gnu/libcurl.so.4 /usr/lib/libcurl.so.3
# Go back home and remove the temporary directory from your home path
cd && rm -rf ~/libcurl3


2. Then setting the env var LD_PRELOAD we can now load mongo
env LD_PRELOAD=/usr/lib/libcurl.so.3 mongo

With that being said, you can create a mongo alias in your .bashrc file
and now use mongo as a standalone command:
alias mongo="env LD_PRELOAD=/usr/lib/libcurl.so.3 mongo"