To install curl on Ubuntu 26.04 or 24.04, use APT for the Ubuntu-managed package, or Snap for a separately packaged version. curl transfers data to and from websites and other services from the terminal.
This guide covers installation, examples, updates and removal, plus an introduction to building from source. If you need help, leave a comment or contact us.
Before you begin
Ubuntu 26.04 or 24.04, a terminal and internet access.
A user account with sudo access to install packages.
Check existing installations before adding another copy.
APT: Best for most Ubuntu users. Ubuntu manages the package and its updates.
Snap: A separate third-party package with automatic updates and some file-access limits.
Source: For a custom build. You maintain its updates yourself.
1. Install curl with APT
1 Check your system
Open a terminal with Ctrl+Alt+T and check whether curl is already available:
Terminal
command -v curl
curl --version
If installed, the first command prints a path and the second shows its version and supported protocols. If it is missing, continue below.
2 Refresh and install
Refresh package information, then install curl. Review the proposed changes and confirm if prompted.
Terminal
sudo apt update
sudo apt install curl
APT installs required dependencies. If the update fails, resolve the error before installing.
3 Verify the Ubuntu package
Check the installed package and run its executable directly:
Terminal
apt policy curl
/usr/bin/curl --version
Policy shows installed and available versions. Ubuntu may backport security fixes without matching the latest upstream version number.
2. Install curl with Snap (Alternative)
The curl Snap is published by a third party, not the curl project. The publisher describes confined file access: it can access non-hidden files under your home directory, with an exception for .curlrc. Check the listing for current permissions.
1 Check Snap and install
Check that snapd responds, then install:
Terminal
snap version
sudo snap install curl
If Snap is unavailable, install snapd with sudo apt install snapd, then start a new session or restart if needed.
2 Run the Snap explicitly
This avoids accidentally running a different installation:
Terminal
snap run curl --version
snap list curl
In the examples below, replace curl with snap run curl if you chose Snap. A bare command may select another installation; check with type -a curl.
3. Build from Source (Advanced)
A source build is useful for custom features or a newer upstream release. This example installs separately from Ubuntu packages. You are responsible for rebuilding it when security updates are released.
1 Install build tools
Install curl, build tools, the OpenSSL and public suffix list development libraries, and tools used for signature checks and tests:
If APT reports an error, resolve it before continuing.
2 Download the release and signature
This example uses curl 8.23.0. Check the curl download page for newer releases. Create a new working folder; if it already exists, choose a different unused folder.
Terminal
mkdir ~/curl-source-example && cd ~/curl-source-example
Download the official archive, its matching signature and the release manager’s public key. Each download starts only if the previous one succeeds. If a download fails, stop and check the error:
Continue only if GnuPG reports a good signature from the checked key. An untrusted-signature warning can appear when the key is not certified in your personal trust database; the independently checked fingerprint is essential. A bad signature, wrong fingerprint or missing key means stop.
4 Extract, build and test
After successful verification, extract the archive and enter the extracted folder:
Terminal
tar -xzf curl-8.23.0.tar.gz && cd curl-8.23.0
Configure a separate installation under your home directory. Each step starts only if the previous one succeeds. If a command fails, stop and check the error:
Terminal
./configure --prefix="$HOME/opt/curl-custom" --with-openssl --disable-shared &&
make &&
make test &&
make install
make test can take time; some tests may need additional tools or be skipped. Investigate failures before installing. Check the result with ~/opt/curl-custom/bin/curl --version. This path keeps the custom build separate from /usr/bin/curl. Keep the source directory and build options for future updates.
4. Useful curl Examples
1 Read a web page
Fetch a small example page and print its HTML in the terminal:
Terminal
curl https://example.com/
HTML tags are expected; curl retrieves data rather than displaying a rendered page.
2 Download to a named file
Save the page in your current directory. Choose an unused filename: curl can overwrite an existing file.
-L follows redirects, -f reports HTTP errors, and -o sets the output name. Check the file with ls -l example-page.html.
3 Check response headers
Ask for response headers to inspect the status and content type:
Terminal
curl -I https://example.com/
Look for a status such as 200. Some sites handle HEAD requests differently from normal downloads.
Use trusted download URLs and verify checksums or signatures when provided. Avoid piping unreviewed downloads directly into a shell. Do not routinely bypass certificate checks with -k.
4 Get data from a test API
An API is a way for programs to request data from a service. This example requests a sample task from a public test API. The response uses JSON, a text format for structured data:
The fields describe the sample task; completed: false means it is not complete. curl helps you inspect a response without writing a program. If the request fails, check the network and any error message.
5. Update curl
For APT, refresh the package list and upgrade curl if an update is available:
Snap normally refreshes automatically. To request an update:
Terminal
sudo snap refresh curl
snap run curl --version
For a source build, obtain and verify a newer release, rebuild it with the same prefix and options, run tests, and reinstall it. APT and Snap do not update your custom build.
Troubleshooting
1 Command not found
Run type -a curl. Install the APT package if no command is found, or use snap run curl for Snap. Invoke a custom build by its full path unless you add its bin directory to PATH.
2 Certificate or connection errors
Check the address, network access and system clock. Check that ca-certificates is installed and current. A corporate proxy or untrusted server certificate may require administrator help. Do not disable certificate verification.
3 Permission denied when saving
Save to a directory your user can write to. Snap has additional restrictions, including hidden paths. Check available disk space and package permissions.
6. Remove curl
Remove only the installation you chose. Before confirming an APT removal, read the list of packages that will also be removed; other tools or scripts may need curl.
Terminal
sudo apt remove curl
For Snap, use:
Terminal
sudo snap remove curl
For the custom source build, remove its dedicated ~/opt/curl-custom folder only after checking that it contains no files you need. This does not remove the archive, source tree or build dependencies. If another installation remains, curl may still work; check type -a curl.