thesuhu / how-to-build-and-install-latest-curl-version-on-centos.md
Previously I’ve written about How to Build and Install Latest cURL Version on Ubuntu. In this article in this article explain how to build and install latest cURL version on CentOS.
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@centos-8-1 ~]$ curl --version curl 7.61.1 (x86_64-redhat-linux-gnu) libcurl/7.61.1 OpenSSL/1.1.1g zlib/1.2.11 brotli/1.0.6 libidn2/2.2.0 libpsl/0 .20.2 (+libidn2/2.2.0) libssh/0.9.4/openssl/zlib nghttp2/1.33.0 Release-Date: 2018-09-05 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz brotli TLS-SRP HTTP2 UnixSocke ts HTTPS-proxy PSL
Above shows the installed cURL version 7.61.0. While currently the latest version of cURL is 7.80.0. Go to https://curl.se/download/ to check the latest cURL version.
Download cURL latest 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.
Install required packages.
sudo yum install wget gcc openssl-devel make -y
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.
Go to the extracted directory of downloaded cURL source file.
Now it’s time to build with configure command.
./configure --prefix=/usr/local --with-ssl
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 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@centos-8-1 ~]$ curl --version curl 7.80.0 (x86_64-pc-linux-gnu) libcurl/7.80.0 OpenSSL/1.1.1k-fips zlib/1.2.11 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 HTTPS-proxy IPv6 Largefile libz 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 # Tested on CentOS 7 and CentOS 8 # Check the latest version at https://curl.se/download/ VERSION=7.80.0 cd ~ sudo yum update -y sudo yum install wget gcc openssl-devel make -y wget https://curl.haxx.se/download/curl-$ .tar.gz tar -xzvf curl-$ .tar.gz rm -f curl-$ .tar.gz cd curl-$ ./configure --prefix=/usr/local --with-ssl make sudo make install sudo ldconfig cd ~ rm -rf curl-$
That’s all and if you find it useful please star ( ⭐ ) & share.
How to Build and Install latest cURL version on CentOS and Ubuntu?
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.
Looking to build the latest cURL from the source?
cURL shipped with the OS may not be up-to-date, and if you need the newest version for a particular requirement, then you need to build from the source.
Lately, I was testing HTTP/3 using cURL with the default shipped version on CentOS, but that didn’t work. BTW, there are more you can do with cURL.
[root@lab ~]# curl --version curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.44 zlib/1.2.7 libidn/1.28 libssh2/1.8.0 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets [root@lab ~]#
However, the latest cURL version (7.67) supports HTTP/3. So, I had only one option – build from the source. This is just one example; you may have some other requirements.
The following example is for 7.67 (latest as I write) on CentOS 8.x and Ubuntu 20.x. But the procedure remains the same for any other version.
Prerequisite
Let’s get the required dependencies installed.
- Update the system. Though this is optional, I prefer doing so. I always have up-to-date installed packages.
yum install wget gcc openssl-devel -y
wget https://curl.haxx.se/download/curl-7.67.0.tar.gz
gunzip -c curl-7.67.0.tar.gz | tar xvf -
It would create a new folder on the present working directory
Building cURL on CentOS/RHEL
Once you’ve downloaded and extracted the latest cURL, it’s time to build them.
configure: Configured to build curl/libcurl: Host setup: x86_64-pc-linux-gnu Install prefix: /usr/local Compiler: gcc CFLAGS: -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread CPPFLAGS: LDFLAGS: LIBS: -lssl -lcrypto -lssl -lcrypto -lz curl version: 7.67.0 SSL: enabled (OpenSSL) SSH: no (--with-libssh2) zlib: enabled brotli: no (--with-brotli) GSS-API: no (--with-gssapi) TLS-SRP: no (--enable-tls-srp) resolver: POSIX threaded IPv6: enabled Unix sockets: enabled IDN: no (--with-) Build libcurl: Shared=yes, Static=yes Built-in manual: enabled --libcurl option: enabled (--disable-libcurl-option) Verbose errors: enabled (--disable-verbose) Code coverage: disabled SSPI: no (--enable-sspi) ca cert bundle: /etc/pki/tls/certs/ca-bundle.crt ca cert path: no ca fallback: no LDAP: no (--enable-ldap / --with-ldap-lib / --with-lber-lib) LDAPS: no (--enable-ldaps) RTSP: enabled RTMP: no (--with-librtmp) Metalink: no (--with-libmetalink) PSL: no (libpsl not found) Alt-svc: no (--enable-alt-svc) HTTP2: disabled (--with-nghttp2) HTTP3: disabled (--with-ngtcp2, --with-quiche) ESNI: no (--enable-esni) Protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP Features: SSL IPv6 UnixSockets libz AsynchDNS NTLM NTLM_WB HTTPS-proxy
It will take a few seconds to complete, and once done; you can verify the version to ensure it has installed successfully.
Building cURL on Ubuntu
I assume you have downloaded the latest version as explained in the prerequisite section.
apt-get install -y binutils-common binutils make
- If you don’t have the above dependencies (binutils) installed then you may get the following error.
configure: error: ar not found in PATH. Cannot continue without ar.
Verification
Use —version to see the version details.
# curl --version curl 7.67.0 (x86_64-pc-linux-gnu) libcurl/7.67.0 OpenSSL/1.0.2k-fips zlib/1.2.7 Release-Date: 2019-11-06 Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: AsynchDNS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets #
You see, its easy when you have the steps. I hope this helps you install cURL from the source.
thesuhu / how-to-build-and-install-latest-curl-version-on-ubuntu.md
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.
Download cURL latest 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.
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.
Go to the extracted directory of downloaded cURL source file.
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-$ .tar.gz tar -xzvf curl-$ .tar.gz rm -f curl-$ .tar.gz cd curl-$ ./configure --prefix=/usr/local --with-ssl --with-nghttp2 make -j4 sudo make install sudo ldconfig cd ~ rm -rf curl-$
That’s all and if you find it useful please star ( ⭐ ) & share.