How to Manually Update Curl on Ubuntu Server

Modified on Mon, 16 Dec, 2024 at 5:42 PM

What is curl


Curl is used in command lines or scripts to transfer data. It is also used in cars, television sets, routers, printers, audio equipment, mobile phones, tablets, set-top boxes, media players and is the internet transfer backbone for thousands of software applications affecting billions of humans daily.


Learn more here: https://curl.haxx.se/


Curl is a command-line tool and library for transferring data with URL syntax, supporting HTTP, HTTPS, FTP, FTPS, GOPHER, TFTP, SCP, SFTP, SMB, TELNET, DICT, LDAP, LDAPS, FILE, IMAP, SMTP, POP3, RTSP and RTMP. libcurl offers a myriad of powerful features.


So I recently need to update curl, but Ubuntu has limitations as to what version of curl should be installed on a specific Ubuntu version. The following are curl version that’ll install in your server based on the server Ubuntu version when you run apt install -y curl


Like most Linux distributions, Ubuntu backports security patches so that software like cURL can stay secure without breaking other software by changing the version.

In my case, I’m using Ubuntu server 16.04 in my docker image that builds OpenShift pods that process metrics collection. The curl version was 7.47.0and it was failing to curl the endpoints for metrics collections. So we needed to have (at least7.57.0 or above). So since using apt install curl method wasn’t an option, I had to upgrade it manually.


How to Install Latest Curl Version


Follow these steps to install the latest version of curl on your Ubuntu OS/server regardless of the version. (make sure that you are root by running the following command: sudo su) or add sudo in from the commands.


Step 1:


Remove the currently installed curl if installed:

apt remove curl
apt purge curl

Step 2:


Install the tools to compile this release and curl dependencies:

apt-get update
apt-get install -y libssl-dev autoconf libtool make

Step 3:


Download and install the latest release from http://curl.haxx.se/download.html. Run this commands one by one in ssh terminal:

cd /usr/local/src
rm -rf curl*
wget https://curl.se/download/curl-8.5.0.tar.gz
sudo tar xzf curl-8.5.0.tar.gz

Compile

cd curl-8.5.0     # enter the directory where curl was unpacked #
./buildconf
./configure --with-ssl 
make
make install

Step 4:


Update the system’s binaries and symbol lookup (which libcurl your curl loads):

mv /usr/bin/curl /usr/bin/curl.bak
cp /usr/local/bin/curl /usr/bin/curl

You are done?! The following will display your version of curl:

curl -V
--if you get a curl: symbol lookup error: curl: undefined symbol:--
sudo ldconfig


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article