Server

How to Build and Install latest cURL version on CentOS/RHEL?

Rahul Woll
Published: April 21, 2024
What's on this page:
What's on this page:
cURL

Looking to build the latest cURL installation from the source?

cURL shipped with the OS may not be up-to-date, and if you need the latest version for a particular requirement, then you need to build from the source.

Just, I was testing HTTP/3 using cURL with the default shipped version on CentOS, but that didn’t work.

[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 requirement.

The following example is for 7.67 (latest as I write). But the procedure remains the same for any other version.

Here is how to cURL Installation work

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 update -y

Installing the required packages

yum install wget gcc openssl-devel -y

Download the latest cURL source – you can refer to their official download page to know the latest version.

wget https://curl.haxx.se/download/curl-7.67.0.tar.gz

Extract the downloaded gz file.

gunzip -c curl-7.67.0.tar.gz | tar xvf

It would create a new folder on the present working directory.

Building cURL

Once you’ve downloaded and extracted the latest cURL, its time to build them.

Go inside the newly created folder after extraction

cd curl-7.67.0

Configure with SSL as below

./configure --with-ssl

You will see output something like below.

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-{libidn2,winidn})
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

Let’s install them

make install

It will take a few seconds to complete, and once done; you can verify the version to ensure it has installed successfully.

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
#

Note: You see, its easy when you have the steps. I hope this helps you install cURL from the source.