How to Install cURL on Ubuntu

Deepak Prasad
Tested on Ubuntu 26.04 LTS (Resolute Raccoon)
Package curl 8.18.0-1ubuntu2.8
libcurl4t64 8.18.0-1ubuntu2.8
Applies to Ubuntu 22.04 LTS, 24.04 LTS, and 26.04 LTS (curl base version differs by release)
Privilege sudo or root for apt
Scope Install the curl CLI on Ubuntu with apt, check whether it is already present, verify with curl --version and an HTTPS request, and understand how Ubuntu's security-patched package relates to upstream curl.se releases; optional Snap and source pointers only. Does not cover curl scripting, POST/auth examples, or deep PATH troubleshooting—see dedicated guides below.
Related guides apt command in Linux
cURL command syntax and options
Fix bash curl command not found
Fix curl SSL certificate problem behind proxy
Check Ubuntu version
Short on time?Beta Get the gist of this 9-minute read in seconds, then ask follow-up questions

cURL transfers data over HTTP, HTTPS, FTP, and other network protocols from the shell. curl is the command-line program you run in a terminal; libcurl is the underlying library that curl and other applications use. On Ubuntu you normally install the curl package with apt—that is what installers, CI jobs, and tutorials expect at /usr/bin/curl.

This guide was tested on Ubuntu 26.04 (package version 8.18.0-1ubuntu2.8). The same apt workflow applies on 24.04 and 22.04 with different base versions (see the table below). For everyday usage after install, see cURL command syntax and options.


Quick answer

Refresh indexes and install the curl package from Ubuntu's archive:

bash
sudo apt update

Install the curl package and its libcurl dependency:

bash
sudo apt install curl

Verify the binary and version:

bash
curl --version

Confirm which path your shell resolves:

bash
command -v curl

Confirm DNS, TLS, and HTTP work (-I fetches response headers only, without downloading the page body):

bash
curl -I https://example.com

For normal Ubuntu use, prefer this apt package. Ubuntu may report an older upstream version number than curl.se while still shipping security fixes in the package revision—details in the next section.


Before you begin

Run these commands in a terminal on the Ubuntu system where you want cURL. Installing packages requires a user that can run sudo.

  • curl — command-line program
  • libcurl — library used by curl and other programs
  • PATH — directories your shell searches when you type a command; command -v curl shows which curl executable would run
  • Upstream — a release published directly by the curl project at curl.se

curl --version shows the curl base version, linked libraries, and supported protocols. Use apt-cache policy curl or dpkg-query when you need Ubuntu's complete package revision (including security updates).


cURL versions on Ubuntu 26.04, 24.04, and 22.04

Ubuntu curl base version (upstream line) Library package
26.04 LTS 8.18.0 libcurl4t64
24.04 LTS 8.5.0 libcurl4t64
22.04 LTS 7.81.0 libcurl4

Run apt-cache policy curl on your system. The full Ubuntu package version, such as 8.18.0-1ubuntu2.8, includes the upstream curl version plus Ubuntu packaging and security-update revisions on top of the base line curl --version prints.

NOTE
Security note: upstream curl 8.23.0 shipped on 14 October 2026 together with multiple security advisories. Ubuntu publishes patched curl packages through main and security archives. Run sudo apt update before installing or upgrading curl rather than compiling upstream solely because the base version number on curl.se looks newer.

Why Ubuntu's cURL version can be older than curl.se

Canonical keeps a stable base curl release per Ubuntu LTS and backports security fixes into new package revisions (8.18.0-1ubuntu2.x, 8.5.0-2ubuntu10.x, and similar). That is why curl --version on Ubuntu 26.04 can show 8.18.0 while curl.se lists a newer stable release.

Compare the full Ubuntu package version and your update status—not the upstream minor number alone—when you judge whether the distro package is maintained. For most servers and desktops, apt curl is the right choice.


Check whether cURL is already installed

Minimal cloud images and containers often ship without curl. Check whether curl is already available:

bash
command -v curl

If the command prints a path such as /usr/bin/curl, the CLI is already available—run curl --version to see the build. An empty result means you need sudo apt install curl.


Install cURL on Ubuntu with APT

Ubuntu documents installing the command-line client with apt install curl; that pulls in the matching libcurl runtime automatically.

Install the curl package

Refresh indexes and inspect what apt would install. In apt-cache policy output, Candidate is the version apt chooses for a new install or upgrade:

Refresh package indexes first:

bash
sudo apt update

Read the Candidate line for curl:

bash
apt-cache policy curl

On Ubuntu 26.04 (amd64) the installed and candidate lines matched at the time of testing:

output
curl:
  Installed: 8.18.0-1ubuntu2.8
  Candidate: 8.18.0-1ubuntu2.8

Install the package. Use the full subcommand install—sudo apt curl alone triggers E: Invalid operation curl:

bash
sudo apt install curl

Verify the installed version

Print the curl base version, linked libraries, and protocols:

bash
curl --version
output
curl 8.18.0 (x86_64-pc-linux-gnu) libcurl/8.18.0 OpenSSL/3.5.5 zlib/1.3.1 brotli/1.2.0 zstd/1.5.7 ...
Release-Date: 2026-01-07
Protocols: dict file ftp ftps gopher gophers http https imap imaps ...

Show Ubuntu's complete package revision (including security updates):

bash
dpkg-query -W -f='${Version}\n' curl
output
8.18.0-1ubuntu2.8

curl --version reports the upstream curl line and build features; dpkg-query reports the full Debian package version apt installed.

The CLI should live under /usr/bin on an apt install:

bash
command -v curl
output
/usr/bin/curl

Test an HTTPS request

Headers only are enough to prove the binary, resolver, TLS stack, and HTTP client work:

bash
curl -I https://example.com
output
HTTP/2 200
date: Sun, 18 Oct 2026 07:59:07 GMT
content-type: text/html

Save a file once if you want to confirm a download path (more examples live in the cURL command guide):

bash
curl -o /tmp/page.html https://example.com

curl vs libcurl on Ubuntu

Need Package
Run curl commands curl
Compile C/C++ code against libcurl (OpenSSL) libcurl4-openssl-dev
Compile against libcurl (GnuTLS flavour) libcurl4-gnutls-dev

The curl package is the CLI. libcurl4t64 (or libcurl4 on 22.04) is the shared library apt installs as a dependency—other programs link to it. Do not remove libcurl packages just because you uninstalled the CLI; use apt-cache rdepends libcurl4t64 (or libcurl4 on 22.04) to inspect reverse dependencies before removing the library, and review APT's removal plan carefully.

Install libcurl development headers

Only when you are building software that links to libcurl:

bash
sudo apt install libcurl4-openssl-dev

Pick the GnuTLS dev package instead when your project requires that build flavour.


Optional: Install cURL with Snap

The curl Snap is a community Snap, not the normal Ubuntu or upstream curl package. It may track newer release lines but runs under Snap confinement; Snapcraft notes that hidden files and directories under $HOME may be inaccessible except .curlrc.

bash
sudo snap install curl

Prefer sudo apt install curl for shell scripts, bootstrap installers (curl … | sh), and normal administration. Use Snap only when you deliberately want that confined build.


Optional: Install a newer cURL from source

Build from curl.se source install documentation only when you need a feature, TLS backend, or curl release that Ubuntu does not ship—and you accept maintaining the build yourself. Upstream releases frequently; a full compile walkthrough on this page would go stale every few weeks.

Upstream recommends verifying release tarballs with GPG signatures before extraction. For typical Ubuntu workstations and servers, stay on the security-supported apt package instead.


Update cURL on Ubuntu

For normal security maintenance, apply your regular system updates so curl, libcurl, and related binaries stay aligned:

bash
sudo apt update

Install upgraded packages from those indexes:

bash
sudo apt upgrade

If you only want to refresh the installed curl CLI package, this also pulls the latest Ubuntu revision for that package:

bash
sudo apt install --only-upgrade curl

Security fixes can affect libcurl and other binaries built from the same source package—not only the curl command—so prefer apt upgrade when you are patching after a security advisory.


Uninstall cURL

Remove only the CLI package if you no longer need the command:

bash
sudo apt remove curl

Use sudo apt purge curl only when you also want to drop removed-package configuration files.

Do not purge libcurl4t64 or libcurl4 unless you have confirmed nothing else depends on them. Other tools may still require the library after the curl binary is gone.

If you installed the Snap build:

bash
sudo snap remove curl

Troubleshooting

Symptom Likely cause Fix
curl: command not found Package not installed, or wrong PATH sudo apt install curl; if apt shows curl installed but the shell still fails, see fix bash curl command not found
E: Invalid operation curl Missing install subcommand sudo apt install curl, not sudo apt curl
curl / libcurl version mismatch Partial upgrade or mixed mirrors Compare curl with the matching libcurl runtime for your release (libcurl4t64 on 24.04/26.04, libcurl4 on 22.04); sudo apt update; reinstall both packages when candidates match
Wrong curl after manual build /usr/local/bin before /usr/bin command -v curl; remove the custom binary or adjust PATH
HTTPS certificate errors behind a proxy Corporate CA not in trust store Fix curl SSL certificate problem behind proxy
Could not resolve host DNS or typo Fix hostname; check resolver and VPN

Summary

Install cURL on Ubuntu with sudo apt update and sudo apt install curl, then confirm curl --version, command -v curl, and curl -I https://example.com. Ubuntu 26.04, 24.04, and 22.04 each ship a fixed base curl version with security backports in the package revision—compare apt's full version string to curl.se, not the upstream number alone.

Use the curl package for the CLI; add libcurl4-openssl-dev (or GnuTLS) only when compiling against libcurl. Skip the Snap for most automation, and compile from upstream only for exceptional needs. If the shell cannot find curl after a successful install, use the dedicated bash curl command not found guide rather than piling fixes onto this page.


References


Frequently Asked Questions

Is cURL installed by default on Ubuntu?

Not always. Server and container images often omit it. Run command -v curl; if nothing prints, install with sudo apt install curl.

Does this work on Ubuntu 24.04 and 22.04?

Yes. Use the same sudo apt install curl workflow. Expect base curl 8.5.0 on 24.04 and 7.81.0 on 22.04, with libcurl4t64 on 24.04+ and libcurl4 on 22.04.

Why is Ubuntu's cURL older than the latest upstream release?

Ubuntu keeps a stable base version per release and ships security fixes as new package revisions. Run sudo apt update and upgrade curl from Ubuntu archives rather than assuming an older base number means the package is unpatched.

Should I install cURL with APT or Snap?

Use apt for normal use. The Snap is optional, confined, and can behave differently around hidden paths under your home directory.

What is the difference between cURL and libcurl?

curl is the command you run in the terminal. libcurl is the library behind it (and behind many other programs). apt install curl pulls in the matching runtime library automatically.

How do I uninstall cURL without breaking other software?

Run sudo apt remove curl or sudo apt purge curl for the CLI only. Leave libcurl4t64 installed unless you have verified no other packages depend on it.

Why does apt say E: Invalid operation curl?

You omitted the install subcommand. The correct form is sudo apt install curl.

What if apt cannot find a curl package?

Confirm that Ubuntu's main repository is enabled and sudo apt update completes without mirror errors—not the Universe component, which is not required for curl itself.

Finished reading?Beta Get the key takeaways in seconds, then ask follow-up questions
Omer Cakmak

Linux Administrator

Highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on OpenStack, KVM, Proxmox, and VMware.

  • Debian
  • Ubuntu
  • Linux
  • Red Hat Enterprise Linux
  • Shell Script
  • System Administration