# Written by The Suhu (2021).
# Tested on Ubuntu 20.04 LTS
The default cURL installed on the operating system may not be the latest version. if you want the latest version, then you need to build from the source. Let's check the cURL version installed with the following command.
thesuhu@ubuntu-1:~$ curl --version
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.
0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp s
mtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL T
LS-SRP UnixSockets
Above shows the installed cURL version 7.68.0. While currently the latest version of cURL is 7.80.0. Go to https://curl.se/download/ to check the latest cURL version.
Before we download the latest version of cURL, let's update the system. It's optional but I prefer to do this to keep the installed packages up to date.
sudo apt-get update -y
Install required packages.
sudo apt-get install -y nghttp2 libnghttp2-dev libssl-dev build-essential wget
Download the latest cURL source. In this tutorial we will download 7.80.0 version.
wget https://curl.haxx.se/download/curl-7.80.0.tar.gz
Then extract the downloaded.
tar -xzvf curl-7.80.0.tar.gz
Go to the extracted directory of downloaded cURL source file.
cd curl-7.80.0/
Now it's time to build with configure
command.
./configure --prefix=/usr/local --with-ssl --with-nghttp2
Make sure there are no errors from the above command execution. If there are no errors, finally we can install it with the make
command.
make -j4
sudo make install
sudo ldconfig
To make sure the new version is installed successfully, open a new session from terminal/ssh and run the command:
thesuhu@ubuntu-1:~$ curl --version
curl 7.80.0 (x86_64-pc-linux-gnu) libcurl/7.80.0 OpenSSL/1.1.1f nghttp2/1.40.0
Release-Date: 2021-11-10
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet
tftp
Features: alt-svc AsynchDNS HSTS HTTP2 HTTPS-proxy IPv6 Largefile NTLM NTLM_WB SSL TLS-SRP UnixSockets
The cURL version should be 7.80.0.
If you don't want to bother running commands one by one, you can create the script file below and run it.
#! /bin/bash
# Already tested on Ubuntu 20.04
# Check the latest version at https://curl.se/download/
VERSION=7.80.0
cd ~
sudo apt-get update -y
sudo apt-get install -y nghttp2 libnghttp2-dev libssl-dev build-essential wget
wget https://curl.haxx.se/download/curl-${VERSION}.tar.gz
tar -xzvf curl-${VERSION}.tar.gz
rm -f curl-${VERSION}.tar.gz
cd curl-${VERSION}
./configure --prefix=/usr/local --with-ssl --with-nghttp2
make -j4
sudo make install
sudo ldconfig
cd ~
rm -rf curl-${VERSION}
That's all and if you find it useful please star (β) & share.
thanks a bunch for solving me the hassle.