curl is not working on Ubuntu 18.04 LTS

Solution 1:

This problem is common in multiple packages in ubuntu recent LTS. Preinstalled packages have a possible error in version convention because "18.04" and other strings referencing repo are considering as part of the package version and not reference to the repo.
The workaround is uninstall preinstalled dependency and then reinstall. After that, you can install cURL.

apt remove -y libcurl4
apt install -y libcurl4 curl

Other packages with that problem are okular and libsdl2, and the solution is the same, track problematic dependencies, remove and reinstall.

Also, you can use apt downgrade mechanism (thus, is not necessary to uninstall packages that depend of libcurl4).

apt install -y libcurl4=7.58.0-2ubuntu3
apt install -y curl

Solution 2:

Install curl from source. That worked for me.

git clone https://github.com/curl/curl.git
cd curl
./buildconf
./configure
make
make test # optional
sudo make install

Solution 3:

Try to use

sudo apt install libcurl4-openssl-dev

If you get any errors, try the commands below and then the above command again.

sudo apt update
sudo apt remove libcurl4

Solution 4:

To start a clean slate first clean you packages:

sudo apt autoremove
sudo apt remove libcurl4

Then you install libcurl4 and curl

apt install -y libcurl4 curl