How to Install curl on Ubuntu 26.04 and 24.04

Share

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.

Choose an Installation Method

Choose the right method for you

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. It requires build tools and manual security updates. This example installs separately from Ubuntu packages.

1   Install build dependencies

Install the compiler and OpenSSL development files:

Terminal
sudo apt update
sudo apt install build-essential pkg-config libssl-dev libpsl-dev ca-certificates gnupg
2   Download and verify

Download a release archive and its matching signature from the official curl download page. Verify the signature and signing-key fingerprint using curl’s source installation instructions before extracting. Do not trust a key solely because an archive is signed by it.

3   Build in a separate location

Extract the verified archive and open a terminal inside its extracted directory. Run the commands one at a time, stopping if any fail:

Terminal
./configure --prefix="$HOME/opt/curl-custom" --with-openssl --disable-shared
make
make test
make install

Tests can take time and may need additional dependencies; investigate failures before installing. This installs under your home directory. Run ~/opt/curl-custom/bin/curl --version to check it. Keep the source directory and build configuration for maintenance.

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.

Terminal
curl -fL https://example.com/ -o example-page.html

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

5. Update curl

For APT, refresh the package list and upgrade curl if an update is available:

Terminal
sudo apt update
sudo apt install --only-upgrade curl

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.

Helpful Resources

See the curl command reference and the Kubernetes tutorial for a local service example.

Frequently Asked Questions

Is curl already installed on Ubuntu?

It depends on the installation. Run curl –version to check.

Does APT install the newest release?

APT installs the version in configured Ubuntu repositories. Ubuntu can provide security fixes without matching the newest upstream version.

Can APT and Snap coexist?

Yes. A bare curl command can select one based on PATH. Use /usr/bin/curl or snap run curl to select explicitly.

Does curl save a file automatically?

By default curl writes the response to the terminal. Use -o with a filename to save it.

Does removing curl remove its libraries?

Not necessarily. APT may keep libraries used by other packages. Review proposed removals before accepting them.

Related Ubuntu guides: Install Node.js · Install React · APT and Snap commands · Linux terminal commands.