Curl comes pre-installed on most Linux distributions, but verifying its presence or updating to the latest version takes just a terminal command. If you are searching for how to install curl on linux, you have come to the right place. This tool is essential for transferring data using various network protocols, and getting it set up correctly is a fundamental skill for any Linux user.
Whether you are a developer, system administrator, or just a curious user, curl helps you interact with APIs, download files, and test network connections. In this guide, we will walk through the installation process for major Linux distributions, covering everything from basic commands to troubleshooting common issues. You will learn multiple methods to ensure curl is available on your system.
How To Install Curl On Linux
Installing curl on Linux is generally a straightforward process. Most distributions include it in their default package repositories. The exact command you need depends on your specific distribution and its package manager. Below, we cover the most common Linux families.
Installing Curl On Debian And Ubuntu
Debian and Ubuntu are among the most popular Linux distributions. They use the APT package manager. To install curl on these systems, follow these steps.
- Open your terminal application. You can usually find it in your applications menu or by pressing Ctrl+Alt+T.
- First, update your package list to ensure you get the latest version. Run:
sudo apt update - Now, install curl with:
sudo apt install curl -y - After installation, verify it worked by checking the version:
curl --version
That is all you need. The -y flag automatically answers yes to the installation prompt. If you prefer to see the prompt, just omit it. You should now see version information displayed in your terminal.
Installing Curl On Red Hat, CentOS, And Fedora
Red Hat Enterprise Linux, CentOS, and Fedora use the DNF or YUM package managers. Fedora uses DNF by default, while older CentOS versions use YUM. The process is similar for both.
Using DNF On Fedora And Newer RHEL
- Open your terminal.
- Update your system repositories:
sudo dnf update - Install curl:
sudo dnf install curl -y - Verify the installation:
curl --version
Using YUM On Older CentOS And RHEL
- Open your terminal.
- Update your package cache:
sudo yum update - Install curl:
sudo yum install curl -y - Check the version:
curl --version
Both methods work reliably. If you are unsure which package manager your system uses, try the DNF command first. If it fails, switch to YUM.
Installing Curl On Arch Linux And Manjaro
Arch Linux and its derivatives like Manjaro use the Pacman package manager. Installing curl is very simple on these distributions.
- Open your terminal.
- Run:
sudo pacman -S curl - Confirm the installation when prompted.
- Verify with:
curl --version
Arch Linux tends to have very up-to-date packages. You will likely get the latest stable version of curl right away.
Installing Curl On OpenSUSE
OpenSUSE uses the Zypper package manager. The installation steps are as follows.
- Open your terminal.
- Refresh your repositories:
sudo zypper refresh - Install curl:
sudo zypper install curl - Confirm the installation and verify:
curl --version
Zypper handles dependencies automatically, so you should not encounter any issues.
Installing Curl On Alpine Linux
Alpine Linux is a lightweight distribution often used in Docker containers. It uses the APK package manager.
- Open your terminal.
- Update the package index:
apk update - Install curl:
apk add curl - Verify:
curl --version
Note that Alpine does not require sudo if you are logged in as root, which is common in containers. If you are using a standard user account, prefix commands with sudo.
Verifying Your Curl Installation
After installation, you should confirm that curl works correctly. The simplest test is to fetch a webpage or an API endpoint.
- Run:
curl https://example.com - If you see HTML output, curl is working.
- You can also test with:
curl --versionto see the version and supported protocols.
If you get an error, check that you have network connectivity and that the URL is correct. Common errors include “could not resolve host” which indicates a DNS issue.
Installing Curl From Source
Sometimes you need a specific version of curl that is not available in your distribution’s repositories. In that case, compiling from source is an option. This process is more advanced but gives you full control.
- First, install build dependencies. On Debian/Ubuntu:
sudo apt install build-essential libssl-dev. On RHEL/CentOS:sudo yum groupinstall "Development Tools"andsudo yum install openssl-devel. - Download the source code from the official curl website:
wget https://curl.se/download/curl-7.88.1.tar.gz(replace with the latest version). - Extract the archive:
tar -xzf curl-7.88.1.tar.gz - Change into the directory:
cd curl-7.88.1 - Configure the build:
./configure --with-ssl - Compile:
make - Install:
sudo make install - Verify:
curl --version
Compiling from source can take a few minutes. Ensure you have enough disk space and patience. This method is best for advanced users who need specific features or patches.
Using Snap Or Flatpak To Install Curl
Some Linux distributions support Snap or Flatpak packages. These are sandboxed applications that run on multiple distributions. While curl is typically installed via the system package manager, you can use these alternatives if needed.
Installing Curl Via Snap
Snap is available on Ubuntu and many other distributions. To install curl via Snap:
- Ensure Snap is installed:
sudo snap install core - Install curl:
sudo snap install curl - Verify:
curl --version
Snap packages update automatically, which can be convenient. However, they may have slight performance overhead compared to native packages.
Installing Curl Via Flatpak
Flatpak is another universal package system. To use it:
- Ensure Flatpak is installed and configured with a remote like Flathub.
- Install curl:
flatpak install flathub org.curl.curl - Run curl:
flatpak run org.curl.curl
Note that Flatpak versions of curl might not be as integrated with the system as native installations. Use this method only if you have specific requirements.
Common Installation Issues And Fixes
Even with straightforward instructions, things can go wrong. Here are some common problems and how to resolve them.
Permission Denied Errors
If you see “Permission denied” when trying to install, you likely forgot to use sudo. Most package managers require superuser privileges. Re-run the command with sudo at the beginning.
Package Not Found
If your package manager says “package not found,” your repository list might be outdated. Update your package cache first. On Debian/Ubuntu: sudo apt update. On RHEL: sudo yum update. Then try again.
Dependency Issues
Sometimes curl requires libraries like OpenSSL or libssh2. The package manager should handle these automatically. If you see dependency errors, try installing them manually. For example: sudo apt install libssl-dev on Debian.
Version Conflicts
If you have an older version of curl installed and want to upgrade, use the update command for your package manager. For example: sudo apt upgrade curl. This will replace the old version with the latest available in your repositories.
Updating Curl To The Latest Version
Keeping curl updated is important for security and new features. The update process varies by distribution.
- Debian/Ubuntu:
sudo apt update && sudo apt upgrade curl - RHEL/CentOS/Fedora:
sudo dnf update curlorsudo yum update curl - Arch Linux:
sudo pacman -Syu(updates all packages) - OpenSUSE:
sudo zypper update curl - Alpine:
apk update && apk upgrade curl
If you installed from source, you need to download the new source code and repeat the compilation process. Alternatively, you can use a package manager like Snap for automatic updates.
Uninstalling Curl
If you no longer need curl, you can remove it. The command depends on your distribution.
- Debian/Ubuntu:
sudo apt remove curl - RHEL/CentOS/Fedora:
sudo dnf remove curlorsudo yum remove curl - Arch:
sudo pacman -R curl - OpenSUSE:
sudo zypper remove curl - Alpine:
apk del curl
Removing curl will not affect other system tools unless they depend on it. You can always reinstall it later.
Frequently Asked Questions
How Do I Check If Curl Is Already Installed On My Linux System?
Open your terminal and type curl --version. If you see version information, curl is installed. If you get a “command not found” error, you need to install it.
Can I Install Curl Without Internet Access On Linux?
Yes, you can download the curl package from another computer and transfer it via USB or network. Then install it using the package manager’s local install feature, like sudo dpkg -i curl.deb on Debian.
What Is The Difference Between Curl And Wget?
Both are command-line tools for downloading data. Curl supports more protocols and is better for API interactions. Wget is simpler for recursive downloads. Curl is more versatile for scripting.
How Do I Install Curl On A Docker Container?
Inside the Dockerfile or container, use the package manager of the base image. For example, on Ubuntu: apt update && apt install curl -y. On Alpine: apk add curl.
Why Does Curl Show A Version But Not Work For HTTPS?
This usually means curl was compiled without SSL support. You need to install a version with SSL, like libcurl4-openssl-dev on Debian. Alternatively, compile from source with --with-ssl.
By now, you should have a solid understanding of how to install curl on linux across various distributions. The process is simple and consistent, whether you use APT, DNF, Pacman, or compile from source. Curl is a powerful tool that will serve you well in many tasks, from downloading files to testing web services. Keep your installation updated, and refer back to this guide if you ever need to set it up again on a new system.