Can't install CURL on Ubuntu 18.4LTS (libcurl4 required) but installing it remove libcurl3 and thus mongo not working properly

14,071

Solution 1

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 a LD_LIBRARY folder in home, copy the libcurl.so.4 there and rename to libcurl.so.3

 mkdir ~/LD_LIBRARY
 cp /usr/lib/x86_64-linux-gnu/libcurl.so.4 ~/LD_LIBRARY/
 mv ~/LD_LIBRARY/libcurl.so.4 ~/LD_LIBRARY/libcurl.so.3

make a link of libcurl3 by:

cd ~/LD_LIBRARY
ln -s libcurl.so.3 libcurl.so.4
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/LD_LIBRARY/" >> ~/.bashrc
source ~/.bashrc

now start mongod 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

Solution 2

Here is How I solve curl installation error:

First I install required version of libcurl4 on which curl depends:

 sudo apt-get install curl

This command give error that

 curl : Depends: libcurl4 (= 7.58.0-2ubuntu3.8ppa2) but it is not going to be installed

I first install libcurl4 required version which in my case is libcurl4-7.58.0-2ubuntu3.8ppa2 note in your case it my differ:

sudo apt-get install libcurl4=7.58.0-2ubuntu3.8ppa2

After installation of libcurl4 I install curl which get installed and work fine:

sudo apt-get install curl
Share:
14,071
Maaz Ali
Author by

Maaz Ali

Software Engineer, willing to learn and explore new technologies!

Updated on June 10, 2022

Comments

  • Maaz Ali
    Maaz Ali almost 2 years

    Reading package lists... Done Building dependency tree
    Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

    The following packages have unmet dependencies: curl : Depends: libcurl4 (= 7.58.0-2ubuntu3.1) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

  • Sergio
    Sergio over 5 years
    Can't do that. Apache (and others) depends on libcurl4, and system will uninstall it.
  • bhawnesh dipu
    bhawnesh dipu over 5 years
    You shoud try first as there is no official way to do this and i am using in my laptop
  • Sergio
    Sergio over 5 years
    If you install libcurl3 with 'apt install libcurl3', apt will ask to remove apache (and other packages) first. I can't uninstall apache from my server, it's a production ambient.
  • bhawnesh dipu
    bhawnesh dipu over 5 years
    So if that is the problem with your server . you can do one thing is that on a same os architecture server with almost same configuration (hardware and software) install libcurl3 copy the file /usr/lib/x86_64-linux-gnu/libcurl.so.4 to your orignal server in /home/user/LD_LIBRARY/libcurl.so.4 then set the path in bashrc for LD_LIBRARY and you are good to go with mongo and your apache.
  • Corey Ogburn
    Corey Ogburn over 5 years
    Where am I supposed to be making the libcurl.so.4 symlink?
  • bhawnesh dipu
    bhawnesh dipu over 5 years
    any where you want in your home directory and make sure to alter the PATH ENVIRONMENT VARIABLE as per your need of libcurl v4 or v3. which ever comes first in path the SYSTEM or application you are using will take that.
  • bhawnesh dipu
    bhawnesh dipu over 3 years